Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] eapply: Output verbosely only if patch fails to apply with -F0
Date: Wed, 27 Nov 2019 19:16:34
Message-Id: a9c8c50de89198824279e55c0fa4d28ff7efd404.camel@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH] eapply: Output verbosely only if patch fails to apply with -F0 by Zac Medico
1 On Wed, 2019-11-27 at 11:13 -0800, Zac Medico wrote:
2 > On 11/27/19 10:54 AM, Michał Górny wrote:
3 > > 12d0c48ad disabled silent output for eapply, in order to obtain fuzz
4 > > factors in build logs. However, this also causes eapply to report all
5 > > patched files which can make logs unreadable when there are no fuzz
6 > > factors to be reported. Instead, use verbose output only when applying
7 > > the patch with -F0 fails.
8 > >
9 > > To achieve that, attempt to apply each patch with -F0 --dry-run first.
10 > > If this succeeds, just silently apply the patch for real. If it
11 > > doesn't, output an explicit eqawarn that the patch does not apply
12 > > cleanly and retry with the default fuzz factor and verbose output.
13 > > Non-silenced output applies both to successful application with fuzz
14 > > and to failure.
15 > >
16 > > Signed-off-by: Michał Górny <mgorny@g.o>
17 > > ---
18 > > bin/phase-helpers.sh | 16 ++++++++++++++--
19 > > 1 file changed, 14 insertions(+), 2 deletions(-)
20 > >
21 > > diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
22 > > index 60f8d3243..6f9b52678 100644
23 > > --- a/bin/phase-helpers.sh
24 > > +++ b/bin/phase-helpers.sh
25 > > @@ -995,8 +995,20 @@ if ___eapi_has_eapply; then
26 > > # -f to avoid interactivity
27 > > # -g0 to guarantee no VCS interaction
28 > > # --no-backup-if-mismatch not to pollute the sources
29 > > - ${patch_cmd} -p1 -f -g0 --no-backup-if-mismatch \
30 > > - "${patch_options[@]}" < "${f}"
31 > > + local all_opts=(
32 > > + -p1 -f -g0 --no-backup-if-mismatch
33 > > + "${patch_options[@]}"
34 > > + )
35 > > + # try applying with -F0 first, output a verbose warning
36 > > + # if fuzz factor is necessary
37 > > + if ${patch_cmd} "${all_opts[@]}" --dry-run -s -F0 \
38 > > + < "${f}" &>/dev/null; then
39 > > + all_opts+=( -s -F0 )
40 > > + else
41 > > + eqawarn " patch failed to apply without a fuzz factor, please rebase"
42 >
43 > The earlier ebegin call only outputs the basename, so there could be
44 > some confusion about the origin of the patch. This function is also
45 > called by eapply_user, it's possible that people could get confused and
46 > report bugs about fuzz in their local patches. Other than that it looks
47 > good.
48 >
49
50 Ok, I will add a full path.
51
52 --
53 Best regards,
54 Michał Górny

Attachments

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