| set -euo pipefail | |
| ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" | |
| list_release_files() { | |
| PYTHONPATH="$ROOT/scripts" python3 - "$ROOT" <<'PY' | |
| from pathlib import Path | |
| import sys | |
| from release import load_config, manifest_paths | |
| root = Path(sys.argv[1]) | |
| _, config = load_config(root / "release_config.json") | |
| paths = set(manifest_paths(root, config, code_only=True)) | |
| paths.difference_update(config.get("integrity_manifests", [])) | |
| for path in sorted(paths): | |
| print(path) | |
| PY | |
| } | |
| file_size_bytes() { | |
| if stat -f '%z' "$1" >/dev/null 2>&1; then | |
| stat -f '%z' "$1" | |
| else | |
| stat -c '%s' "$1" | |
| fi | |
| } | |
| ( | |
| cd "$ROOT" | |
| list_release_files | while read -r path; do | |
| openssl dgst -r -sha256 "$path" | sed 's/ \*/ /' | |
| done | |
| ) > "$ROOT/manifest_sha256.txt" | |
| ( | |
| cd "$ROOT" | |
| printf "path\tsize_bytes\n" | |
| list_release_files | while read -r path; do | |
| printf "%s\t%s\n" "$path" "$(file_size_bytes "$path")" | |
| done | |
| ) > "$ROOT/manifest_filesizes.tsv" | |
| echo "[OK] wrote $ROOT/manifest_sha256.txt" | |
| echo "[OK] wrote $ROOT/manifest_filesizes.tsv" | |