validate-board-viewer-detached.sh 1.1 KB

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env bash
  2. # Thin entrypoint: detached-derived validation for board-viewer six assets.
  3. # Does not require BRD; never claims BRD regeneration (not_packaged_by_policy).
  4. # Prefer PRODU2_VERIFY_VENV Python so jsonschema and other verify deps resolve.
  5. set -euo pipefail
  6. unset LD_LIBRARY_PATH LD_PRELOAD QT_PLUGIN_PATH || true
  7. ROOT="$(cd "$(dirname "$0")/.." && pwd)"
  8. VENV="${PRODU2_VERIFY_VENV:-}"
  9. if [[ -z "$VENV" && -x "/opt/prod2u/venv/bin/python" ]]; then
  10. VENV="/opt/prod2u/venv"
  11. elif [[ -z "$VENV" ]]; then
  12. VENV="${XDG_CACHE_HOME:-$HOME/.cache}/prod2u/venvs/verify"
  13. fi
  14. PY="${VENV}/bin/python"
  15. if [[ ! -x "$PY" ]]; then
  16. PY=python3
  17. fi
  18. # Keep a clean system PATH for subprocess tools, but never put it ahead of the
  19. # selected interpreter (venv must win for site-packages such as jsonschema).
  20. export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${PATH:+:$PATH}"
  21. LOG_DIR="${BOARDVIEW_LOG_DIR:-}"
  22. ARGS=()
  23. if [[ -n "$LOG_DIR" ]]; then
  24. mkdir -p "$LOG_DIR"
  25. ARGS+=(--json-out "$LOG_DIR/detached-derived-report.json")
  26. fi
  27. cd "$ROOT/tools/board-viewer"
  28. exec "$PY" -B validate_detached_derived.py "${ARGS[@]}" "$@"