Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o, "Michał Górny" <mgorny@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH v2] eapply: Output verbosely only if patch fails to apply with -F0
Date: Wed, 27 Nov 2019 19:30:42
Message-Id: 3dbcfab5-fa68-83c6-5946-43e2fa797dfa@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH v2] eapply: Output verbosely only if patch fails to apply with -F0 by "Michał Górny"
1 On 11/27/19 11:17 AM, Michał Górny wrote:
2 > 12d0c48ad disabled silent output for eapply, in order to obtain fuzz
3 > factors in build logs. However, this also causes eapply to report all
4 > patched files which can make logs unreadable when there are no fuzz
5 > factors to be reported. Instead, use verbose output only when applying
6 > the patch with -F0 fails.
7 >
8 > To achieve that, attempt to apply each patch with -F0 --dry-run first.
9 > If this succeeds, just silently apply the patch for real. If it
10 > doesn't, output an explicit eqawarn that the patch does not apply
11 > cleanly and retry with the default fuzz factor and verbose output.
12 > Non-silenced output applies both to successful application with fuzz
13 > and to failure.
14 >
15 > Signed-off-by: Michał Górny <mgorny@g.o>
16 > ---
17 > bin/phase-helpers.sh | 16 ++++++++++++++--
18 > 1 file changed, 14 insertions(+), 2 deletions(-)
19 >
20 > Changes in v2:
21 > - added original path to output
22 >
23 > diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
24 > index 60f8d3243..b5691bd70 100644
25 > --- a/bin/phase-helpers.sh
26 > +++ b/bin/phase-helpers.sh
27 > @@ -995,8 +995,20 @@ if ___eapi_has_eapply; then
28 > # -f to avoid interactivity
29 > # -g0 to guarantee no VCS interaction
30 > # --no-backup-if-mismatch not to pollute the sources
31 > - ${patch_cmd} -p1 -f -g0 --no-backup-if-mismatch \
32 > - "${patch_options[@]}" < "${f}"
33 > + local all_opts=(
34 > + -p1 -f -g0 --no-backup-if-mismatch
35 > + "${patch_options[@]}"
36 > + )
37 > + # try applying with -F0 first, output a verbose warning
38 > + # if fuzz factor is necessary
39 > + if ${patch_cmd} "${all_opts[@]}" --dry-run -s -F0 \
40 > + < "${f}" &>/dev/null; then
41 > + all_opts+=( -s -F0 )
42 > + else
43 > + eqawarn " ${f}: patch failed to apply without a fuzz factor, please rebase"
44 > + fi
45 > +
46 > + ${patch_cmd} "${all_opts[@]}" < "${f}"
47 > failed=${?}
48 > if ! eend "${failed}"; then
49 > __helpers_die "patch -p1 ${patch_options[*]} failed with ${f}"
50 >
51
52 Looks good. Please merge.
53 --
54 Thanks,
55 Zac

Attachments

File name MIME type
signature.asc application/pgp-signature