Name tarballs by content so a cached copy can never be stale

The tarball host serves archives as immutable for a year, but a rebuild of
the same JASP version reused jasp-desktop-<ver>-x86_64.tar.zst with new bytes,
so a cache could hand out the old tarball against the new PKGBUILD's sha256.
The name now carries the first 12 hex digits of its sha256, and the PKGBUILD
keeps that name locally too, so a stale download in the build directory no
longer fails the checksum either.

Claude-Session: https://claude.ai/code/session_01GGe7kUhooMFuzY6GaDb2w9
This commit is contained in:
agw
2026-09-30 21:45:00 +02:00
parent cda61649d4
commit 00463ae4b3
2 changed files with 14 additions and 6 deletions
+10 -5
View File
@@ -579,13 +579,18 @@ ICU_MAJOR="$(echo "$ICU_FULL" | grep -oE '^[0-9]+')"
BOOST_FULL="$(pkgver_of boost-libs)"
JASP_VER="${JASP_TAG#v}"
TARBALL="jasp-desktop-${JASP_VER}-x86_64.tar.zst"
log "creating $TARBALL"
# The name carries a prefix of the content hash. The tarball host serves these
# as immutable for a year, so a name must never be reused for different bytes:
# a rebuild of the same JASP version would otherwise let a cache hand out the
# old tarball against the new PKGBUILD's sha256.
log "creating tarball"
cd "$STAGE_DIR"
tar --zstd -cf "$OUT_DIR/$TARBALL" .
SHA256="$(sha256sum "$OUT_DIR/$TARBALL" | awk '{print $1}')"
tar --zstd -cf "$OUT_DIR/jasp-desktop.tar.zst.tmp" .
SHA256="$(sha256sum "$OUT_DIR/jasp-desktop.tar.zst.tmp" | awk '{print $1}')"
TARBALL="jasp-desktop-${JASP_VER}-${SHA256:0:12}-x86_64.tar.zst"
mv "$OUT_DIR/jasp-desktop.tar.zst.tmp" "$OUT_DIR/$TARBALL"
SIZE="$(stat -c%s "$OUT_DIR/$TARBALL")"
log "created $TARBALL"
cat >"$OUT_DIR/build-info.json" <<EOF
{