40 lines
1.8 KiB
Bash
Executable File
40 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
repo_root=$(cd "$(dirname "$0")/.." && pwd)
|
|
check_root=$(mktemp -d "${TMPDIR:-/tmp}/sized-package.XXXXXX")
|
|
trap 'rm -rf "$check_root"' EXIT
|
|
"$repo_root/scripts/release.sh" --output-dir "$check_root/bundle"
|
|
mkdir "$check_root/extracted" "$check_root/fixture"
|
|
tar -xzf "$check_root/bundle.tar.gz" -C "$check_root/extracted"
|
|
for required in sized sized.1 sized.bash _sized sized.fish LICENSE README.md MANUAL.md BUILD-INFO.txt LICENCES.txt DEPENDENCIES.json CORE-SNAPSHOT.json docs/UPGRADING-2.md docs/RELEASE-LICENSING.md; do
|
|
test -s "$check_root/extracted/$required"
|
|
done
|
|
test -x "$check_root/extracted/sized"
|
|
(
|
|
cd "$check_root"
|
|
if command -v sha256sum >/dev/null 2>&1; then
|
|
sha256sum -c bundle.tar.gz.sha256
|
|
else
|
|
shasum -a 256 -c bundle.tar.gz.sha256
|
|
fi
|
|
)
|
|
printf 'owned package fixture\n' > "$check_root/fixture/payload"
|
|
"$check_root/extracted/sized" --version
|
|
"$check_root/extracted/sized" "$check_root/fixture" --apparent --format json > "$check_root/result.json"
|
|
grep -q 'payload' "$check_root/result.json"
|
|
grep -q '"complete":true' "$check_root/result.json"
|
|
if "$repo_root/scripts/release.sh" --output-dir "$check_root/bundle" > "$check_root/repeat.log" 2>&1; then
|
|
printf 'Packaging unexpectedly replaced an existing output.\n' >&2
|
|
exit 1
|
|
fi
|
|
grep -q 'Refusing to replace' "$check_root/repeat.log"
|
|
ln -s "$check_root/untouched" "$check_root/linked.tar.gz"
|
|
if "$repo_root/scripts/release.sh" --output-dir "$check_root/linked" > "$check_root/linked.log" 2>&1; then
|
|
printf 'Packaging unexpectedly followed an existing archive symlink.\n' >&2
|
|
exit 1
|
|
fi
|
|
grep -q 'Refusing to replace' "$check_root/linked.log"
|
|
test ! -e "$check_root/untouched"
|
|
printf 'Archive contents, checksum, extracted CLI and overwrite guard passed.\n'
|