diff options
| author | Danilo M. <danix@danix.xyz> | 2026-06-26 12:12:44 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-06-26 12:12:44 +0200 |
| commit | 9f73d3ab872340cdada91a451e5be2702187d18b (patch) | |
| tree | 762701096c05911a33d9862f711108dd4db7523b | |
| parent | 33f1ef5cfbfc0e99c1a824f27548c4328273713d (diff) | |
| download | mkwheels-9f73d3ab872340cdada91a451e5be2702187d18b.tar.gz mkwheels-9f73d3ab872340cdada91a451e5be2702187d18b.zip | |
mkwheels: add selftest asserting byte-identical tarballs
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| -rwxr-xr-x | selftest | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/selftest b/selftest new file mode 100755 index 0000000..126f5e8 --- /dev/null +++ b/selftest @@ -0,0 +1,23 @@ +#!/bin/bash +# selftest — build six twice and assert the wheels tarballs are byte-identical. +# The smallest check that fails if the reproducible-tar normalization breaks. +set -eu + +here=$(cd "$(dirname "$0")" && pwd) +tmp=$(mktemp -d) +trap 'rm -rf "$tmp"' EXIT + +# Fixed epoch so both runs use the same mtime (we are testing tar determinism, +# not epoch derivation). +OUTPUT="$tmp/a" "$here/mkwheels" six 1.16.0 1620000000 >/dev/null +OUTPUT="$tmp/b" "$here/mkwheels" six 1.16.0 1620000000 >/dev/null + +a=$(md5sum "$tmp/a/six-wheels-1.16.0.tar.gz" | cut -d' ' -f1) +b=$(md5sum "$tmp/b/six-wheels-1.16.0.tar.gz" | cut -d' ' -f1) + +if [ "$a" = "$b" ]; then + echo "PASS: reproducible ($a)" +else + echo "FAIL: tarballs differ ($a != $b)" >&2 + exit 1 +fi |
