The vendored flare-ui was a Nov-4 snapshot with no recorded pin. Advance it to the furthest-along upstream branch: blueflare/flare-ui `sprint` (0e1f5a259faa), which is 247 commits beyond `main`, 71 beyond `next`, and already contains `next` in full. The scattered 1-3 commit leads on individual sp/* feature branches are unmerged side-work, not a more-ahead integration line, so vendoring one of those would drop the 247-commit integration; `sprint` is the single most-ahead branch. This brings sprint's flare-ui crate additions (form.rs, page.rs, page/, table.rs and the flare-ui-axum / flare-plugin-host crates) into the tree. Record the pin in flare-ui.lock so the next re-vendor is reproducible. alkane-os builds against it with no source changes: the console (console.rs) and the rest compile clean, clippy -D warnings is clean, and 183 lib + integration tests pass (including the dashboard schema tests, so the wschema model stayed compatible). Re-verified the live console on sprint: --serve-sim boots, the flare-ui shell and control pages render, and stop -> ambient:18000 -> start all succeed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BdKQBPjAXpCwmigUov5eQk
185 lines
7.6 KiB
Bash
Executable File
185 lines
7.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Keep a consumer's vendored copy of flare-ui pinned to one release tag.
|
|
# Run inside the consumer repository (flare, flare-edge). The consumer
|
|
# vendors this script too, as its own locked file.
|
|
#
|
|
# vendor.sh check every vendored file matches the lock
|
|
# vendor.sh check --upstream DIR ...and the lock matches that tag in a
|
|
# checkout of flare-ui
|
|
# vendor.sh sync DIR TAG copy the locked trees from TAG in DIR
|
|
# and rewrite the lock
|
|
#
|
|
# The lock is flare-ui.lock at the consumer's repository root:
|
|
#
|
|
# tag <vN.N.N>
|
|
# commit <40-hex commit the tag points at>
|
|
# tree <path in flare-ui> <path in this repository>
|
|
# <git blob id> <path in flare-ui> <path in this repository>
|
|
#
|
|
# `tree` lines are written by hand. `sync` expands each into one blob line
|
|
# per file. A tree whose source is a directory owns its destination
|
|
# directory: a file there that the lock does not name fails `check`. A tree
|
|
# whose source is a single file locks only that file.
|
|
#
|
|
# A consumer pins a release tag, never an untagged commit: `sync` refuses
|
|
# anything that is not a `v<N>.<N>.<N>` tag. The lock names no host; where
|
|
# flare-ui lives is the caller's business.
|
|
set -euo pipefail
|
|
|
|
die() { echo "vendor: $*" >&2; exit 1; }
|
|
|
|
root=$(git rev-parse --show-toplevel 2>/dev/null) || die "run inside the consumer repository"
|
|
lock="$root/flare-ui.lock"
|
|
tag_re='^v[0-9]+\.[0-9]+\.[0-9]+$'
|
|
|
|
trees() {
|
|
[ -f "$lock" ] || die "no flare-ui.lock at $root"
|
|
awk '$1 == "tree" { print $2, $3 }' "$lock"
|
|
}
|
|
|
|
entries() {
|
|
grep -Ev '^(#|tag |commit |tree |[[:space:]]*$)' "$lock" || true
|
|
}
|
|
|
|
locked_field() {
|
|
awk -v k="$1" '$1 == k { print $2 }' "$lock"
|
|
}
|
|
|
|
# Files under a vendored directory that the lock does not name.
|
|
unlisted() {
|
|
local seen=$1 src dest file rel
|
|
while read -r src dest; do
|
|
[ -d "$root/$dest" ] || continue
|
|
# A single-file tree has a file destination, skipped above.
|
|
while IFS= read -r -d '' file; do
|
|
rel=${file#"$root/"}
|
|
case " $seen " in *" $rel "*) ;; *) echo "$rel";; esac
|
|
done < <(find "$root/$dest" -type f -print0 -o -type l -print0)
|
|
done < <(trees)
|
|
}
|
|
|
|
check() {
|
|
local upstream="" bad=0 seen="" blob src dest have want tag commit
|
|
if [ "${1:-}" = "--upstream" ]; then
|
|
upstream=${2:?--upstream needs a flare-ui checkout}
|
|
fi
|
|
tag=$(locked_field tag)
|
|
[[ "$tag" =~ $tag_re ]] || die "flare-ui.lock has no vN.N.N tag line"
|
|
commit=$(locked_field commit)
|
|
[[ "$commit" =~ ^[0-9a-f]{40}$ ]] || die "flare-ui.lock has no 40-hex commit line"
|
|
if [ -n "$upstream" ]; then
|
|
want=$(git -C "$upstream" rev-parse --verify --quiet "refs/tags/$tag^{commit}" 2>/dev/null) \
|
|
|| die "upstream has no tag $tag"
|
|
if [ "$want" != "$commit" ]; then
|
|
echo "upstream: tag $tag is $want, the lock says $commit"; bad=1
|
|
fi
|
|
fi
|
|
while read -r blob src dest extra; do
|
|
[ -z "${extra:-}" ] || die "lock line has more than three fields: $blob $src $dest $extra"
|
|
[[ "$blob" =~ ^[0-9a-f]{40}$ ]] || die "lock line for $dest has no blob id"
|
|
case " $seen " in *" $dest "*) die "$dest is locked twice";; esac
|
|
seen="$seen $dest"
|
|
if [ ! -f "$root/$dest" ]; then
|
|
echo "missing: $dest (locked from $src)"; bad=1; continue
|
|
fi
|
|
have=$(git hash-object "$root/$dest")
|
|
if [ "$have" != "$blob" ]; then
|
|
echo "drift: $dest is $have, the lock says $blob ($src at $tag)"; bad=1
|
|
fi
|
|
if [ -n "$upstream" ] && [ "$want" = "$commit" ]; then
|
|
have=$(git -C "$upstream" rev-parse --verify --quiet "$commit:$src" 2>/dev/null) \
|
|
|| { echo "upstream: $src does not exist at $tag"; bad=1; continue; }
|
|
if [ "$have" != "$blob" ]; then
|
|
echo "upstream: $src at $tag is $have, the lock says $blob"; bad=1
|
|
fi
|
|
fi
|
|
done < <(entries)
|
|
[ -n "$seen" ] || die "flare-ui.lock lists no files"
|
|
# A tree line nobody synced has no blob line, so nothing above looked at
|
|
# the files it stands for (flare-ui#43).
|
|
local tsrc tdest covered item
|
|
while read -r tsrc tdest; do
|
|
covered=0
|
|
for item in $seen; do
|
|
case "$item" in "$tdest"|"$tdest"/*) covered=1; break;; esac
|
|
done
|
|
if [ "$covered" -eq 0 ]; then
|
|
echo "unsynced: tree $tsrc $tdest has no locked file; run sync"; bad=1
|
|
fi
|
|
done < <(trees)
|
|
local extra_file
|
|
while IFS= read -r extra_file; do
|
|
[ -n "$extra_file" ] || continue
|
|
echo "unlisted: $extra_file is in a vendored directory but not in the lock"; bad=1
|
|
done < <(unlisted "$seen")
|
|
if [ "$bad" -ne 0 ]; then
|
|
echo "vendor: vendored flare-ui files do not match flare-ui.lock." >&2
|
|
echo "Change them in flare-ui, tag a release, then re-sync; never edit them here." >&2
|
|
exit 1
|
|
fi
|
|
echo "vendor: $(echo "$seen" | wc -w) files match flare-ui $tag"
|
|
}
|
|
|
|
sync() {
|
|
local dir=${1:?sync needs a flare-ui checkout} tag=${2:?sync needs a tag}
|
|
[[ "$tag" =~ $tag_re ]] || die "$tag is not a release tag (vN.N.N); pin tags, never commits"
|
|
local commit
|
|
commit=$(git -C "$dir" rev-parse --verify --quiet "refs/tags/$tag^{commit}") \
|
|
|| die "$tag is not a tag in $dir"
|
|
local tree_list
|
|
tree_list=$(trees)
|
|
[ -n "$tree_list" ] || die "flare-ui.lock has no tree lines"
|
|
local tmp src dest mode blob path rel stage
|
|
tmp=$(mktemp "$root/.flare-ui.lock.XXXXXX")
|
|
stage=$(mktemp -d "$root/.flare-ui-stage.XXXXXX")
|
|
trap 'rm -rf "$tmp" "$stage"' EXIT
|
|
{
|
|
echo "# flare-ui files vendored here. Generated by vendor.sh sync;"
|
|
echo "# check with vendor.sh check. Never edit a vendored file in place."
|
|
echo "tag $tag"
|
|
echo "commit $commit"
|
|
while read -r src dest; do
|
|
echo "tree $src $dest"
|
|
done <<< "$tree_list"
|
|
while read -r src dest; do
|
|
git -C "$dir" cat-file -e "$commit:$src" 2>/dev/null || die "$src does not exist at $tag"
|
|
while read -r mode _ blob path; do
|
|
case "$mode" in 100644|100755) ;; *) die "$path is not a regular file (mode $mode)";; esac
|
|
case "$path" in *[[:space:]]*) die "$path has whitespace in its name";; esac
|
|
if [ "$path" = "$src" ]; then rel=$dest; else rel="$dest/${path#"$src"/}"; fi
|
|
mkdir -p "$(dirname "$stage/$rel")"
|
|
git -C "$dir" cat-file blob "$blob" > "$stage/$rel"
|
|
[ "$mode" = 100755 ] && chmod +x "$stage/$rel"
|
|
echo "$blob $path $rel"
|
|
done < <(git -C "$dir" ls-tree -r "$commit" -- "$src")
|
|
done <<< "$tree_list"
|
|
} > "$tmp"
|
|
# Replace each vendored directory wholesale, then the lock.
|
|
while read -r src dest; do
|
|
if [ -d "$stage/$dest" ]; then
|
|
rm -rf "${root:?}/$dest"
|
|
mkdir -p "$(dirname "$root/$dest")"
|
|
cp -a "$stage/$dest" "$root/$dest"
|
|
else
|
|
mkdir -p "$(dirname "$root/$dest")"
|
|
cp -a "$stage/$dest" "$root/$dest"
|
|
fi
|
|
done <<< "$tree_list"
|
|
mv "$tmp" "$lock"
|
|
rm -rf "$stage"
|
|
trap - EXIT
|
|
check --upstream "$dir"
|
|
}
|
|
|
|
# One brace group that ends in exit: bash parses all of it before running
|
|
# any of it, so when sync copies a new vendor.sh over this running file, bash
|
|
# never reads on into the new file's bytes (flare-ui#45).
|
|
{
|
|
case "${1:-}" in
|
|
check) shift; check "$@";;
|
|
sync) shift; sync "$@";;
|
|
*) echo "usage: vendor.sh check [--upstream DIR] | sync DIR TAG" >&2; exit 2;;
|
|
esac
|
|
exit
|
|
}
|