abuild: provide a list of patches that failed

Try all patches and return of list of patches that failed rather than
exit on first failed patch.
This commit is contained in:
Natanael Copa 2020-07-06 10:13:36 +00:00
parent 14a81655e4
commit ff11a9a0a8
1 changed files with 12 additions and 4 deletions

View File

@ -687,7 +687,7 @@ have_patches() {
} }
default_prepare() { default_prepare() {
local i local i failed=
[ -n "$builddir" -a -d "$builddir" ] && cd "$builddir" [ -n "$builddir" -a -d "$builddir" ] && cd "$builddir"
if ! have_patches; then if ! have_patches; then
return 0 return 0
@ -697,18 +697,26 @@ default_prepare() {
case ${i%::*} in case ${i%::*} in
*.patch) *.patch)
msg "${i%::*}" msg "${i%::*}"
patch ${patch_args:--p1} -i "$srcdir/$(filename_from_uri $i)" || return 1 patch ${patch_args:--p1} -i "$srcdir/$(filename_from_uri $i)" || failed="$failed $i"
;; ;;
*.patch.gz) *.patch.gz)
msg "${i%::*}" msg "${i%::*}"
gunzip -c "$srcdir/$(filename_from_uri $i)" | patch ${patch_args:--p1} || return 1 gunzip -c "$srcdir/$(filename_from_uri $i)" | patch ${patch_args:--p1} || failed="$failed $i"
;; ;;
*.patch.xz) *.patch.xz)
msg "${i%::*}" msg "${i%::*}"
unxz -c "$srcdir/$(filename_from_uri $i)" | patch ${patch_args:--p1} || return 1 unxz -c "$srcdir/$(filename_from_uri $i)" | patch ${patch_args:--p1} || failed="$failed $i"
;; ;;
esac esac
done done
if [ -z "$failed" ]; then
return 0
fi
error "The following patches failed to apply:"
for i in $failed; do
printf " %s\n" "$i"
done
return 1
} }
prepare() { prepare() {