#!/bin/bash # selftest — build twice and assert the wheels tarballs are byte-identical, for # both modes. The smallest check that fails if the reproducible-tar # normalization (or either mode's resolution) 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 test tar determinism, not # epoch derivation). epoch=1620000000 fail=0 check() { local label=$1 file=$2; shift 2 OUTPUT="$tmp/a" "$here/mkwheels" "$@" --epoch "$epoch" >/dev/null OUTPUT="$tmp/b" "$here/mkwheels" "$@" --epoch "$epoch" >/dev/null local a b a=$(md5sum "$tmp/a/$file" | cut -d' ' -f1) b=$(md5sum "$tmp/b/$file" | cut -d' ' -f1) if [ "$a" = "$b" ]; then echo "PASS: $label reproducible ($a)" else echo "FAIL: $label tarballs differ ($a != $b)" >&2 fail=1 fi } # pypi mode: six from PyPI. check pypi six-wheels-1.16.0.tar.gz pypi --name six --ver 1.16.0 # gh mode: pyparsing from its GitHub source release (pure-python, no runtime # deps -> fast). Its tags have no 'v' prefix, exercising the bare-tag path. check gh pyparsing-wheels-3.3.2.tar.gz gh --repo pyparsing/pyparsing --ver 3.3.2 exit "$fail"