#!/bin/sh # Every package in Spectra's Cargo.lock must be in one of the lockfiles the # OxygenFlow build image vendors (oxygen, oxygenhub, oxygenflow), at the same # version, or Flow jobs, which have no network, fail with "no matching # package" (spectra#2). The other projects are found beside this one, or # under DEV (default: ..). # # scripts/deps-check.sh set -eu cd "$(dirname "$0")/.." dev=${DEV:-..} pkgs() { awk '/^\[\[package\]\]/{n="";v="";s=0} /^name = /{n=$3} /^version = /{v=$3} /^source = /{s=1; print n" "v}' "$@" | tr -d '"' | sort -u; } have=$(pkgs "$dev/oxygen/Cargo.lock" "$dev/oxygenhub/Cargo.lock" "$dev/oxygenflow/Cargo.lock") need=$(pkgs Cargo.lock) missing=$(printf '%s\n' "$need" | grep -vxF "$have" || true) if [ -n "$missing" ]; then echo "deps-check: these crates are not in the OxygenFlow image's vendored set:" >&2 printf '%s\n' "$missing" | sed 's/^/ /' >&2 echo "pin a version the image has (cargo update -p NAME --precise V), or rebuild the image with Spectra's workspace" >&2 exit 1 fi echo "deps-check: all $(printf '%s\n' "$need" | wc -l) crates are vendored in the image"