#!/bin/bash # SPDX-License-Identifier: MIT # The dependency trees in external/ (git-ignored), each at its recorded revision. # # scripts/external.sh add what is missing # scripts/external.sh --check say whether each is at its revision # # sega32x-rust-fast: the board builds on the -fast tiers, as worktrees of the clones beside # this repository on branches made for it (never switching those checkouts: play-md builds # from ../megadrive-rust-fast): # megadrive-rust-fast branch sockets-32x (its `sockets` + megadrive-rust's sockets-32x) # sh2-rust-fast branch board-context (its main + sh2-rust's board-context) # The upstream side, what the gate judges against, as private clones (nothing is added to # those repositories): megadrive-rust and sh2-rust at sega32x-rust's pins, the sound cores # both boards find as ../ym2612-rust and the others, the reference sega32x-python, and # `base`, this repository at the fork point (sega32x-rust 5b1bd11) as a worktree whose # external/ is this one (a link), so it builds sega32x-rust exactly as upstream pins it. set -u ROOT=$(cd "$(dirname "$0")/.." && pwd) EXT="$ROOT/external" # name kind revision (what it is) PINS="megadrive-rust-fast worktree 8f5cf5f sockets-32x: megadrive-rust-fast sockets 9995ffb + megadrive-rust sockets-32x ef621e6 sh2-rust-fast worktree 43ab381 board-context: sh2-rust-fast main 49a009d + sh2-rust board-context c5634ef megadrive-rust clone ef621e6 upstream's board: sockets-32x (sockets 0959147 + the five hooks); md_trace.py for the reference sh2-rust clone c5634ef upstream's SH-2: board-context ym2612-rust clone a3ae306 both boards' path dependency sn76489-rust clone ac95bea both boards' path dependency ssp1601-rust clone 7249814 both boards' path dependency sega32x-python clone 0553957 the reference (src tree d532709) base self 5b1bd11 sega32x-rust at the fork point, built against the clones above" status=0 while read -r name kind rev what; do dir="$EXT/$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 mkdir -p "$EXT" case $kind in worktree) echo "$name: make the branch's worktree by hand (git -C ../$name worktree add ...)"; status=1 ;; clone) git clone -q --no-checkout "$ROOT/../$name" "$dir" && git -C "$dir" checkout -q --detach "$rev" ;; self) git -C "$ROOT" worktree add -q --detach "$dir" "$rev" && ln -s .. "$dir/external" ;; esac fi done <<< "$PINS" exit $status