Format Beffroi shell scripts and record local verification
Beffroi Reporting CI All checks passed and encrypted report archives were built.
Beffroi/beffroi-reporting/pipeline/head This commit looks good
Details
Beffroi Reporting CI All checks passed and encrypted report archives were built.
Beffroi/beffroi-reporting/pipeline/head This commit looks good
Details
This commit is contained in:
parent
4f6186e28b
commit
0fb87796f8
|
|
@ -61,7 +61,7 @@ Proposed command mapping (names can change before implementation):
|
|||
packages and publishes it. Remove component Jenkinsfiles if independent
|
||||
component CI is no longer required; otherwise keep them test-only and update
|
||||
stale messages. Verify clean checkout and `--replace` recovery.
|
||||
- [ ] **T7. Remove confirmed dead paths and format remaining code.** Delete the
|
||||
- [x] **T7. Remove confirmed dead paths and format remaining code.** Delete the
|
||||
duplicate parity wrappers, unused logo copies and retired documentation
|
||||
after checking external callers. Apply `shfmt` or equivalent consistent
|
||||
formatting to remaining Bash, then retain one concise usage/README source
|
||||
|
|
@ -73,13 +73,15 @@ Proposed command mapping (names can change before implementation):
|
|||
usage, macro commands, invalid inputs, no-overwrite/replace behavior,
|
||||
package contents, and CI with the actual worker dependencies.
|
||||
|
||||
Progress: dead wrappers, unused assets, and obsolete docs are removed. Local
|
||||
component tests passed (4 Reportist CLI tests, 29 diagnostic tests, 2 macro
|
||||
source tests). A clean local clone built all 17 PDFs with recorded text/page
|
||||
parity; the working checkout also matched legacy raster pages. Local
|
||||
`--replace` removed old JSON extras and preserved parity. Remaining work is
|
||||
consistent formatting of older Bash/Typst code, package-content verification
|
||||
with `pyzipper`, and a live Jenkins run after the new commits are pushed.
|
||||
Progress: dead wrappers, unused assets, and obsolete docs are removed. All
|
||||
active Bash was formatted with pinned `shfmt-py==4.0.0` and passes `shfmt -d`
|
||||
and `bash -n`. Local component tests passed (4 Reportist CLI tests, 29
|
||||
diagnostic tests, 2 macro source tests). A clean local clone built all 17 PDFs
|
||||
with recorded text/page parity; the working checkout also matched legacy
|
||||
raster pages. Local `--replace` removed old JSON extras and preserved parity.
|
||||
Encrypted archives were opened and verified with pinned `pyzipper`; they hold
|
||||
7 report PDFs and 10 diagnostic PDFs. The only remaining T8 gate is a live
|
||||
Jenkins run after the new commits are pushed.
|
||||
|
||||
## Findings to address
|
||||
|
||||
|
|
|
|||
47
beffroi.sh
47
beffroi.sh
|
|
@ -21,30 +21,43 @@ EOF
|
|||
require() {
|
||||
local missing=() command
|
||||
for command in "$@"; do command -v "$command" >/dev/null 2>&1 || missing+=("$command"); done
|
||||
((${#missing[@]} == 0)) || { echo "Missing tools: ${missing[*]}" >&2; exit 1; }
|
||||
((${#missing[@]} == 0)) || {
|
||||
echo "Missing tools: ${missing[*]}" >&2
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
command_name=${1:-help}; shift || true
|
||||
command_name=${1:-help}
|
||||
shift || true
|
||||
case "$command_name" in
|
||||
report)
|
||||
(($# >= 2))||usage 2; require typst
|
||||
report_input=$1; report_output=$2; shift 2
|
||||
(($# >= 2)) || usage 2
|
||||
require typst
|
||||
report_input=$1
|
||||
report_output=$2
|
||||
shift 2
|
||||
reporter/build.sh render report "$report_input" --output "$report_output" "$@"
|
||||
;;
|
||||
diagnostic-pdf)
|
||||
[[ $# -eq 2 ]]||usage 2; require typst
|
||||
[[ $# -eq 2 ]] || usage 2
|
||||
require typst
|
||||
reporter/build.sh render diagnostic "$1" --output "$2"
|
||||
;;
|
||||
capture-pdf)
|
||||
[[ $# -eq 2 ]]||usage 2; require typst
|
||||
[[ $# -eq 2 ]] || usage 2
|
||||
require typst
|
||||
reporter/build.sh render diagnostic "$1" --output "$2"
|
||||
;;
|
||||
diagnostic)
|
||||
[[ $# -ge 4 && $# -le 6 ]]||usage 2; require git typst
|
||||
[[ $# -ge 4 && $# -le 6 ]] || usage 2
|
||||
require git typst
|
||||
capture=$1 evidence_root=$2 output_dir=$3 reference_time=$4
|
||||
author=${5:-${DIAGNOSTICS_AUTHOR:-Beffroi}}
|
||||
theme=${6:-${DIAGNOSTICS_THEME:-default}}
|
||||
[[ ! -e "$output_dir" ]] || { echo "$output_dir: output directory exists" >&2; exit 1; }
|
||||
[[ ! -e "$output_dir" ]] || {
|
||||
echo "$output_dir: output directory exists" >&2
|
||||
exit 1
|
||||
}
|
||||
mkdir -p "$output_dir"
|
||||
reporter/build.sh analyze "$capture" --evidence-root "$evidence_root" \
|
||||
--output "$output_dir/diagnostic.json" --reference-time "$reference_time" \
|
||||
|
|
@ -53,29 +66,33 @@ case "$command_name" in
|
|||
--author "$author" --theme "$theme"
|
||||
;;
|
||||
all)
|
||||
(($# >= 1))||usage 2; require git typst
|
||||
(($# >= 1)) || usage 2
|
||||
require git typst
|
||||
scripts/build-publication.sh "$@"
|
||||
;;
|
||||
package)
|
||||
[[ $# -eq 2 ]]||usage 2; require uv
|
||||
[[ $# -eq 2 ]] || usage 2
|
||||
require uv
|
||||
scripts/package-reports.sh "$1" "$2"
|
||||
;;
|
||||
test)
|
||||
[[ $# -eq 0 ]]||usage 2; require git typst
|
||||
[[ $# -eq 0 ]] || usage 2
|
||||
require git typst
|
||||
scripts/check-components.sh
|
||||
;;
|
||||
bootstrap)
|
||||
[[ $# -eq 0 ]]||usage 2; require git typst
|
||||
[[ $# -eq 0 ]] || usage 2
|
||||
require git typst
|
||||
./bootstrap.sh
|
||||
;;
|
||||
doctor)
|
||||
[[ $# -eq 0 ]]||usage 2
|
||||
[[ $# -eq 0 ]] || usage 2
|
||||
require git typst
|
||||
echo "Core tools are available."
|
||||
for optional in uv; do
|
||||
if command -v "$optional" >/dev/null 2>&1; then "$optional" --version 2>/dev/null | head -n 1 || true; else echo "Optional tool missing: $optional"; fi
|
||||
done
|
||||
;;
|
||||
help|-h|--help) usage 0;;
|
||||
*) usage 2;;
|
||||
help | -h | --help) usage 0 ;;
|
||||
*) usage 2 ;;
|
||||
esac
|
||||
|
|
|
|||
40
bootstrap.sh
40
bootstrap.sh
|
|
@ -6,46 +6,46 @@ cd "$(dirname "${BASH_SOURCE[0]}")"
|
|||
|
||||
check_only=false
|
||||
if [[ "${1:-}" == "--check" ]]; then
|
||||
check_only=true
|
||||
check_only=true
|
||||
elif [[ $# -ne 0 ]]; then
|
||||
echo "Usage: $0 [--check]" >&2
|
||||
exit 2
|
||||
echo "Usage: $0 [--check]" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
missing=()
|
||||
for command in git typst; do
|
||||
command -v "$command" >/dev/null 2>&1 || missing+=("$command")
|
||||
command -v "$command" >/dev/null 2>&1 || missing+=("$command")
|
||||
done
|
||||
if ((${#missing[@]})); then
|
||||
echo "Missing required tools: ${missing[*]}" >&2
|
||||
echo 'Install Git and Typst, then rerun bootstrap.' >&2
|
||||
exit 1
|
||||
echo "Missing required tools: ${missing[*]}" >&2
|
||||
echo 'Install Git and Typst, then rerun bootstrap.' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! $check_only; then
|
||||
git submodule update --init --recursive
|
||||
git submodule update --init --recursive
|
||||
fi
|
||||
|
||||
for component in reporter reports; do
|
||||
if [[ ! -e "$component/.git" ]]; then
|
||||
echo "Missing component checkout: $component" >&2
|
||||
echo 'Run ./bootstrap.sh with network access to initialize pinned submodules.' >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -e "$component/.git" ]]; then
|
||||
echo "Missing component checkout: $component" >&2
|
||||
echo 'Run ./bootstrap.sh with network access to initialize pinned submodules.' >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
while IFS= read -r status; do
|
||||
if [[ "$status" == -* || "$status" == +* ]]; then
|
||||
echo "Submodule is not at its pinned revision: $status" >&2
|
||||
echo 'Run ./bootstrap.sh to restore the recorded component revisions.' >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ "$status" == -* || "$status" == +* ]]; then
|
||||
echo "Submodule is not at its pinned revision: $status" >&2
|
||||
echo 'Run ./bootstrap.sh to restore the recorded component revisions.' >&2
|
||||
exit 1
|
||||
fi
|
||||
done < <(git submodule status --recursive)
|
||||
git --version
|
||||
typst --version
|
||||
|
||||
if $check_only; then
|
||||
echo 'Pinned components and required tools are available.'
|
||||
exit 0
|
||||
echo 'Pinned components and required tools are available.'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo 'Bootstrap complete. Run scripts/check-components.sh to verify the workspace.'
|
||||
|
|
|
|||
2
reporter
2
reporter
|
|
@ -1 +1 @@
|
|||
Subproject commit 493af046aeed7d1238fff98f8433eef6ae26a652
|
||||
Subproject commit b268af7cb7a1c82bf86edce760afe92a66b0d7ad
|
||||
|
|
@ -20,13 +20,28 @@ while (($#)); do
|
|||
shift
|
||||
done
|
||||
|
||||
[[ ! -L "$output_root" ]] || { echo "$output_root: symlink output root is not supported" >&2; exit 1; }
|
||||
[[ ! -L "$output_root" ]] || {
|
||||
echo "$output_root: symlink output root is not supported" >&2
|
||||
exit 1
|
||||
}
|
||||
output_root=$(python3 -c 'import os, sys; print(os.path.realpath(sys.argv[1]))' "$output_root")
|
||||
root=$(pwd -P)
|
||||
[[ "$output_root" != "$root" && "$root" != "$output_root"/* ]] || { echo "$output_root: output root cannot contain the repository" >&2; exit 1; }
|
||||
[[ "$output_root" != "$root/reports" && "$output_root" != "$root/reports"/* && "$output_root" != "$root/reporter" && "$output_root" != "$root/reporter"/* ]] || { echo "$output_root: output root cannot be inside a source component" >&2; exit 1; }
|
||||
[[ ! -e "$output_root" || -d "$output_root" ]] || { echo "$output_root: output root is not a directory" >&2; exit 1; }
|
||||
[[ ! -e "$output_root" || "$replace" == true ]] || { echo "$output_root: output root already exists; use --replace" >&2; exit 1; }
|
||||
[[ "$output_root" != "$root" && "$root" != "$output_root"/* ]] || {
|
||||
echo "$output_root: output root cannot contain the repository" >&2
|
||||
exit 1
|
||||
}
|
||||
[[ "$output_root" != "$root/reports" && "$output_root" != "$root/reports"/* && "$output_root" != "$root/reporter" && "$output_root" != "$root/reporter"/* ]] || {
|
||||
echo "$output_root: output root cannot be inside a source component" >&2
|
||||
exit 1
|
||||
}
|
||||
[[ ! -e "$output_root" || -d "$output_root" ]] || {
|
||||
echo "$output_root: output root is not a directory" >&2
|
||||
exit 1
|
||||
}
|
||||
[[ ! -e "$output_root" || "$replace" == true ]] || {
|
||||
echo "$output_root: output root already exists; use --replace" >&2
|
||||
exit 1
|
||||
}
|
||||
output_parent=$(dirname "$output_root")
|
||||
mkdir -p "$output_parent"
|
||||
output_name=$(basename "$output_root")
|
||||
|
|
@ -57,5 +72,8 @@ if [[ -d "$output_root" ]]; then
|
|||
mv -- "$output_root" "$backup"
|
||||
fi
|
||||
mv -- "$stage" "$output_root"
|
||||
if [[ -n "$backup" ]]; then rm -rf -- "$backup"; backup=; fi
|
||||
if [[ -n "$backup" ]]; then
|
||||
rm -rf -- "$backup"
|
||||
backup=
|
||||
fi
|
||||
echo "Built publishable reports under $output_root"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,10 @@
|
|||
set -euo pipefail
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")/.."
|
||||
for command in git typst python3 uv; do
|
||||
command -v "$command" >/dev/null 2>&1 || { echo "Missing test dependency: $command" >&2; exit 1; }
|
||||
command -v "$command" >/dev/null 2>&1 || {
|
||||
echo "Missing test dependency: $command" >&2
|
||||
exit 1
|
||||
}
|
||||
done
|
||||
reporter/tests/test.sh
|
||||
python3 -m unittest discover -s scripts/tests -p 'test_*.py' -v
|
||||
|
|
|
|||
|
|
@ -2,9 +2,16 @@
|
|||
set -euo pipefail
|
||||
set +x
|
||||
: "${REPORT_ZIP_PASSWORD:?Set REPORT_ZIP_PASSWORD to encrypt publication archives}"
|
||||
build_root=${1:-}; artifact_dir=${2:-}
|
||||
[[ -n "$build_root" && -n "$artifact_dir" && $# -eq 2 ]]||{ echo "Usage: $0 BUILD_ROOT ARTIFACT_DIR" >&2; exit 2; }
|
||||
command -v uv >/dev/null || { echo "uv is required" >&2; exit 1; }
|
||||
build_root=${1:-}
|
||||
artifact_dir=${2:-}
|
||||
[[ -n "$build_root" && -n "$artifact_dir" && $# -eq 2 ]] || {
|
||||
echo "Usage: $0 BUILD_ROOT ARTIFACT_DIR" >&2
|
||||
exit 2
|
||||
}
|
||||
command -v uv >/dev/null || {
|
||||
echo "uv is required" >&2
|
||||
exit 1
|
||||
}
|
||||
mkdir -p "$artifact_dir"
|
||||
|
||||
# Packaging dependencies belong to this tool and are resolved in uv's cache.
|
||||
|
|
|
|||
Loading…
Reference in New Issue