Print error message if no matching PKGBUILD could be found - #100
Conversation
fcec8b9 to
e34312f
Compare
| exit 0 | ||
| fi | ||
| done | ||
| echo "ERROR: Failed to find commit this was built with (PKGBUILD checksum didn't match any commit)" >&2 |
There was a problem hiding this comment.
if ! bash <<-__END__
[[snip]]
__END__; then
error "Failed to find commit this was built with (PKGBUILD checksum didn't match any commit)"
fi
Shouldn't this work? Then we'd get the exit 1 properly caught and a proper error message as rest of repro.
There was a problem hiding this comment.
I got it to work with braces like this:
if ! (bash <<-__END__
shopt -s globstar
pacman -S asp --noconfirm --needed
asp checkout $pkgbase
pushd $pkgbase
for rev in \$(git rev-list --all -- repos/); do
pkgbuild_checksum=\$(git show \$rev:trunk/PKGBUILD | sha256sum -b)
pkgbuild_checksum=\${pkgbuild_checksum%% *}
if [ \$pkgbuild_checksum = $pkgbuild_sha256sum ]; then
git checkout \$rev
mv ./trunk/* /startdir
exit 0
fi
done
exit 1
__END__
); then
echo "ERROR: Failed to find commit this was built with (PKGBUILD checksum didn't match any commit)" >&2
fiat first I assumed this would be different because we don't know which command caused the non-zero exit code, but since we don't set -e inside that bash process exit 1 is probably the only one?
There was a problem hiding this comment.
An alternative is to capture the exit code and do an "mkinitcpio"-style check?
https://github.com/archlinux/mkinitcpio/blob/master/mkinitcpio#L343-L348
I'm not sure what is the most readable, but I'm a little bit unhappy with the pure echo in the subshell instead of dealing with the bash invocation as a command itself.
It currently looks like this:
With this patch it should look like this: