Files
leleka/scripts/e2e/codex/compare/install.sh
T

52 lines
3.1 KiB
Bash

#!/usr/bin/env bash
# Install the vanilla-vs-Leleka Codex comparison on rnr5090 from this worktree (small writes only: scripts and task files; no model data).
#
# bash scripts/e2e/codex/compare/install.sh
#
# Server layout (inside the work folder ~/work/leleka = /data/leleka-e2e):
# codex-compare/tasks/ frozen task set (read-only), without reference/ solutions; tasks/_external/ holds the vendored three.js
# codex-compare/delta/ runner scripts (read-only): cell.py, logproxy.py, taskfile.py, index.py
# codex-compare/tools/ cmp_codex_job.sh, cmp_window.sh, cmp_report.py (read-only)
# codex-compare/config.toml.tmpl, INSTALL.sha256
# codex-compare/toolchain/ Node.js (install-node.sh), nm/ shared node_modules (install-nestng-deps.sh), runs/ results
# Re-running replaces the scripts; nothing is hard-deleted (earlier installs go to ~/work/leleka/garbage/ with a line in LOG.txt).
set -euo pipefail
HERE=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
CODEX_DIR=$(cd "$HERE/.." && pwd) # scripts/e2e/codex
python3 "$CODEX_DIR/tasks/freeze.py" >/dev/null
python3 "$CODEX_DIR/delta/taskfile.py" check "$CODEX_DIR/tasks" >/dev/null
R=work/leleka/codex-compare
ssh rnr5090 bash -s "$R" <<'REMOTE'
set -euo pipefail
R=$1
mkdir -p "$HOME/$R"; cd "$HOME/$R"
chmod -R u+w tasks delta tools config.toml.tmpl 2>/dev/null || true
if [ -e _stage ]; then G=$HOME/work/leleka/garbage/codex-compare-stage-$(date -u +%Y%m%dT%H%M%S); mkdir -p "$G"; mv _stage "$G/"; echo "$(date -u +%FT%TZ) codex-compare: leftover _stage moved to $G" >> "$HOME/work/leleka/garbage/LOG.txt"; fi
mkdir -p _stage/delta _stage/tasks _stage/tools
REMOTE
STAGE=$R/_stage
tar -C "$CODEX_DIR" --exclude=__pycache__ --exclude='reference' --exclude='selftest.py' -cf - tasks | ssh rnr5090 "tar -xf - -C $STAGE/tasks --strip-components=1"
tar -C "$CODEX_DIR" --exclude=__pycache__ -cf - delta | ssh rnr5090 "tar -xf - -C $STAGE/delta --strip-components=1"
tar -C "$HERE" --exclude=__pycache__ -cf - cmp_codex_job.sh cmp_window.sh cmp_report.py install-node.sh install-nestng-deps.sh gen_stubs.sh | ssh rnr5090 "tar -xf - -C $STAGE/tools"
scp -q "$CODEX_DIR/config.toml.tmpl" "rnr5090:$STAGE/config.toml.tmpl"
ssh rnr5090 bash -s "$R" <<'REMOTE'
set -euo pipefail
R=$1
cd "$HOME/$R/_stage"
mkdir -p tasks/_external
cp "$HOME/work/codex-e2e/vendor/three.module.min.js" tasks/_external/
python3 -I delta/taskfile.py check tasks
cd "$HOME/$R"
G=$HOME/work/leleka/garbage/codex-compare-prev-$(date -u +%Y%m%dT%H%M%S)
mkdir -p "$G"
for x in delta tasks tools config.toml.tmpl; do [ -e "$x" ] && mv "$x" "$G/"; done
echo "$(date -u +%FT%TZ) codex-compare: previous install moved to $G" >> "$HOME/work/leleka/garbage/LOG.txt"
mv _stage/delta delta; mv _stage/tasks tasks; mv _stage/tools tools; mv _stage/config.toml.tmpl config.toml.tmpl; rmdir _stage
mkdir -p runs _active
chmod -R a-w tasks delta tools config.toml.tmpl
( find tasks delta tools -type f -print0 | sort -z | xargs -0 sha256sum; sha256sum config.toml.tmpl ) > INSTALL.sha256.new
mv -f INSTALL.sha256.new INSTALL.sha256
wc -l INSTALL.sha256
REMOTE
echo installed