OXYGENHUB
◆ main spectra / scripts / deps-check.sh
1.1 KiB · Bourne Again Shell (bash) · executable · last changed Project skeleton in Oxygen's shape: workspace, deps/oxygen pinned, make check, version, deps-check (#1) 2 days ago source blame history raw
1
#!/bin/sh
2
# Every package in Spectra's Cargo.lock must be in one of the lockfiles the
3
# OxygenFlow build image vendors (oxygen, oxygenhub, oxygenflow), at the same
4
# version, or Flow jobs, which have no network, fail with "no matching
5
# package" (spectra#2). The other projects are found beside this one, or
6
# under DEV (default: ..).
7
#
8
#   scripts/deps-check.sh
9
set -eu
10
cd "$(dirname "$0")/.."
11
dev=${DEV:-..}
12
pkgs() { awk '/^\[\[package\]\]/{n="";v="";s=0} /^name = /{n=$3} /^version = /{v=$3} /^source = /{s=1; print n" "v}' "$@" | tr -d '"' | sort -u; }
13
have=$(pkgs "$dev/oxygen/Cargo.lock" "$dev/oxygenhub/Cargo.lock" "$dev/oxygenflow/Cargo.lock")
14
need=$(pkgs Cargo.lock)
15
missing=$(printf '%s\n' "$need" | grep -vxF "$have" || true)
16
if [ -n "$missing" ]; then
17
    echo "deps-check: these crates are not in the OxygenFlow image's vendored set:" >&2
18
    printf '%s\n' "$missing" | sed 's/^/  /' >&2
19
    echo "pin a version the image has (cargo update -p NAME --precise V), or rebuild the image with Spectra's workspace" >&2
20
    exit 1
21
fi
22
echo "deps-check: all $(printf '%s\n' "$need" | wc -l) crates are vendored in the image"