On 11/27/19 11:17 AM, Michał Górny wrote:
> 12d0c48ad disabled silent output for eapply, in order to obtain fuzz
> factors in build logs.  However, this also causes eapply to report all
> patched files which can make logs unreadable when there are no fuzz
> factors to be reported.  Instead, use verbose output only when applying
> the patch with -F0 fails.
> 
> To achieve that, attempt to apply each patch with -F0 --dry-run first.
> If this succeeds, just silently apply the patch for real.  If it
> doesn't, output an explicit eqawarn that the patch does not apply
> cleanly and retry with the default fuzz factor and verbose output.
> Non-silenced output applies both to successful application with fuzz
> and to failure.
> 
> Signed-off-by: Michał Górny <mgo...@gentoo.org>
> ---
>  bin/phase-helpers.sh | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> Changes in v2:
> - added original path to output
> 
> diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
> index 60f8d3243..b5691bd70 100644
> --- a/bin/phase-helpers.sh
> +++ b/bin/phase-helpers.sh
> @@ -995,8 +995,20 @@ if ___eapi_has_eapply; then
>                       # -f to avoid interactivity
>                       # -g0 to guarantee no VCS interaction
>                       # --no-backup-if-mismatch not to pollute the sources
> -                     ${patch_cmd} -p1 -f -g0 --no-backup-if-mismatch \
> -                             "${patch_options[@]}" < "${f}"
> +                     local all_opts=(
> +                             -p1 -f -g0 --no-backup-if-mismatch
> +                             "${patch_options[@]}"
> +                     )
> +                     # try applying with -F0 first, output a verbose warning
> +                     # if fuzz factor is necessary
> +                     if ${patch_cmd} "${all_opts[@]}" --dry-run -s -F0 \
> +                                     < "${f}" &>/dev/null; then
> +                             all_opts+=( -s -F0 )
> +                     else
> +                             eqawarn "    ${f}: patch failed to apply 
> without a fuzz factor, please rebase"
> +                     fi
> +
> +                     ${patch_cmd} "${all_opts[@]}" < "${f}"
>                       failed=${?}
>                       if ! eend "${failed}"; then
>                               __helpers_die "patch -p1 ${patch_options[*]} 
> failed with ${f}"
> 

Looks good. Please merge.
-- 
Thanks,
Zac

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to