abuild: default_prepare: Apply GZIP/XZ-compressed *.patch files
This allows using default_prepare to apply compressed patches, e.g. the linux-lts kernel patches (compressed using XZ).
The following code in linux-lts/APKBUILD
can then be replaced with default_prepare
:
local _patch_failed=
cd "$srcdir"/linux-$_kernver
if [ "$_kernver" != "$pkgver" ]; then
msg "Applying patch-$pkgver.xz"
unxz -c < "$srcdir"/patch-$pkgver.xz | patch -p1 -N
fi
# first apply patches in specified order
for i in $source; do
case $i in
*.patch)
msg "Applying $i..."
if ! patch -s -p1 -N -i "$srcdir"/$i; then
echo $i >>failed
_patch_failed=1
fi
;;
esac
done
if ! [ -z "$_patch_failed" ]; then
error "The following patches failed:"
cat failed
return 1
fi
Edited by Minecrell