Skip to content

Commit 674e74a

Browse files
committed
[repro] Rework PKGBUILD fetching
Some PKGBUILDs use _pkgver and so on, so we are unable to count on them being "correct" when fetching PKGBUILDs. We also never implemented support for epoch. Another problem is that we can't go over the commit history and look at `updpkg: ...` values as they might not be there. Instead we traverse the history and find the correct PKGBUILD by checksumming it against the one in the PKGBUILD. Signed-off-by: Morten Linderud <morten@linderud.pw>
1 parent 64931c7 commit 674e74a

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

repro.in

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -241,18 +241,17 @@ install -d -o builduser -g builduser /startdir
241241
pacman -S asp --noconfirm
242242
asp checkout $pkgbase
243243
cd $pkgbase
244-
history=\$(git grep --all-match -e pkgver=$pkgver -e pkgrel=$pkgrel \$(git rev-list --all -- repos/) -- repos/)
245-
cut -d: -f1 <<< \$history | head -1 | xargs git checkout
246-
file_path=\$(cut -d: -f2 <<< \$history | head -1 | xargs dirname)
247-
pkgbuild_checksum=\$(sha256sum -b \$file_path/PKGBUILD)
248-
pkgbuild_checksum=\${pkgbuild_checksum%% *}
249-
if [ \$pkgbuild_checksum != $pkgbuild_sha256sum ]; then
250-
# TODO: use warning or exit
251-
echo "Warning PKGBUILD checksum does not match"
252-
exit 1
253-
fi
254-
mv ./\$file_path/* /startdir
255-
pacman -Rs asp --noconfirm
244+
for rev in \$(git rev-list --all -- repos/); do
245+
pkgbuild_checksum=\$(git show \$rev:trunk/PKGBUILD | sha256sum -b)
246+
pkgbuild_checksum=\${pkgbuild_checksum%% *}
247+
if [ \$pkgbuild_checksum = $pkgbuild_sha256sum ]; then
248+
git checkout \$rev
249+
mv ./trunk/* /startdir
250+
pacman -Rs asp --noconfirm
251+
exit 0
252+
fi
253+
done
254+
exit 1
256255
__END__
257256

258257
msg2 "Preparing packages"

0 commit comments

Comments
 (0)