#!/bin/bash # SPDX-License-Identifier: MIT # The dependency worktrees in external/ (git-ignored), each at its recorded revision, from # clones beside this repository (../megadrive-rust and the others). megadrive-rust's path # dependencies (../ym2612-rust, ../sn76489-rust, ../ssp1601-rust) resolve inside external/. # # scripts/external.sh add what is missing # scripts/external.sh --check say whether each is at its revision set -u ROOT=$(cd "$(dirname "$0")/.." && pwd) # name revision (what it is) PINS="megadrive-rust ef621e6 sockets-32x: sockets 0959147 + video_first, peek_byte's board, sda_line, picture_side, source_side sh2-rust c5634ef board-context: fcb9dae (= sh2-python 8824075) + BusContext waits, wait_pin ym2612-rust a3ae306 megadrive-rust's path dependency, at the HEAD it was built with sn76489-rust ac95bea megadrive-rust's path dependency ssp1601-rust 7249814 megadrive-rust's path dependency sega32x-python 0553957 the reference: its main, local (the sh2-python 8824075 repin, /TIME, decision B6)" status=0 while read -r name rev what; do dir="$ROOT/external/$name" if [ "${1:-}" = "--check" ]; then at=$(git -C "$dir" rev-parse --short=7 HEAD 2>/dev/null || echo missing) [ "$at" = "$rev" ] && echo "$name $rev ok" || { echo "$name: at $at, want $rev ($what)"; status=1; } elif [ ! -e "$dir" ]; then git -C "$ROOT/../$name" worktree add --detach "$dir" "$rev" fi done <<< "$PINS" exit $status