package.sh pins the tar.gz sum it builds in PKGBUILD and .SRCINFO

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
astar76 2026-11-26 18:28:57 -06:00
commit 7d017c96ae
3 changed files with 6 additions and 2 deletions

View file

@ -24,6 +24,6 @@ pkgbase = medlar-bin
options = !strip
options = !debug
source = Medlar-0.1.1-Linux-x86_64.tar.gz::https://archlinux.tail7c4f5e.ts.net/git/astar76/Medlar/releases/download/v0.1.1/Medlar-0.1.1-Linux-x86_64.tar.gz
sha256sums = e89db7fc43b55ec4dc5c919914ffb95702176561eb83a4037ccab21499a2d484
sha256sums = 8794e0e779ea0b09398fff21e60e02924592928c66cf34a96811b11f55b5a4cd
pkgname = medlar-bin

View file

@ -15,7 +15,7 @@ conflicts=('medlar')
options=('!strip' '!debug')
# MEDLAR_TARBALL points at a local copy (offline build); default is the release download.
source=("Medlar-$pkgver-Linux-x86_64.tar.gz::${MEDLAR_TARBALL:-$url/releases/download/v$pkgver/Medlar-$pkgver-Linux-x86_64.tar.gz}")
sha256sums=('62fd4b310834650fe11597d846db37d2109e5aaf8b11c6d690143127335f4327')
sha256sums=('8794e0e779ea0b09398fff21e60e02924592928c66cf34a96811b11f55b5a4cd')
package() {
cd "$srcdir/medlar-$pkgver"

View file

@ -16,6 +16,10 @@ work=$(mktemp -d); trap 'rm -rf "$work"' EXIT
arch_pkg() {
mkdir "$work/arch"; cp packaging/arch/PKGBUILD "$work/arch/"
sum=$(sha256sum "$out/Medlar-$ver-Linux-x86_64.tar.gz" | cut -d" " -f1)
# The PKGBUILD pins the release tar.gz: keep it, and .SRCINFO, on the one just built.
sed -i "s/^sha256sums=(.*/sha256sums=('$sum')/" packaging/arch/PKGBUILD "$work/arch/PKGBUILD"
sed -i "s/^\tsha256sums = .*/\tsha256sums = $sum/" packaging/arch/.SRCINFO
(cd "$work/arch" && MEDLAR_TARBALL="file://$out/Medlar-$ver-Linux-x86_64.tar.gz" makepkg -f -C --nodeps --noconfirm >"$work/makepkg.log" 2>&1) \
|| { tail -20 "$work/makepkg.log"; exit 1; }
cp "$work"/arch/medlar-bin-"$ver"-*-x86_64.pkg.tar.zst "$out/Medlar-$ver-arch-x86_64.pkg.tar.zst"