Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH 06/12] python-utils-r1.eclass: Don't die in python_fix_shebang if all fixed
Date: Fri, 04 Jan 2019 18:26:50
Message-Id: 1546626394.1895.14.camel@gentoo.org
In Reply to: Re: [gentoo-dev] [PATCH 06/12] python-utils-r1.eclass: Don't die in python_fix_shebang if all fixed by Mike Gilbert
1 On Fri, 2019-01-04 at 13:10 -0500, Mike Gilbert wrote:
2 > On Fri, Jan 4, 2019 at 10:55 AM Michał Górny <mgorny@g.o> wrote:
3 > >
4 > > On Thu, 2019-01-03 at 21:39 +0000, James Le Cuirot wrote:
5 > > > Shebangs may need fixing on prefix systems or when cross-building but
6 > > > not at other times.
7 > > >
8 > > > Signed-off-by: James Le Cuirot <chewi@g.o>
9 > > > ---
10 > > > eclass/python-utils-r1.eclass | 8 ++------
11 > > > 1 file changed, 2 insertions(+), 6 deletions(-)
12 > > >
13 > > > diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
14 > > > index 19cfaf2798ab..91e457f3cf14 100644
15 > > > --- a/eclass/python-utils-r1.eclass
16 > > > +++ b/eclass/python-utils-r1.eclass
17 > > > @@ -1328,16 +1328,12 @@ python_fix_shebang() {
18 > > > fi
19 > > > done < <(find -H "${path}" -type f -print0 || die)
20 > > >
21 > > > - if [[ ! ${any_fixed} ]]; then
22 > > > + if [[ ! ${any_fixed} && ! ${any_correct} ]]; then
23 > > > local cmd=eerror
24 > > > [[ ${EAPI:-0} == [012345] ]] && cmd=eqawarn
25 > > >
26 > > > "${cmd}" "QA warning: ${FUNCNAME}, ${path#${D%/}} did not match any fixable files."
27 > > > - if [[ ${any_correct} ]]; then
28 > > > - "${cmd}" "All files have ${EPYTHON} shebang already."
29 > > > - else
30 > > > - "${cmd}" "There are no Python files in specified directory."
31 > > > - fi
32 > > > + "${cmd}" "There are no Python files in specified directory."
33 > > >
34 > > > [[ ${cmd} == eerror ]] && die "${FUNCNAME} did not match any fixable files (QA warning fatal in EAPI ${EAPI})"
35 > > > fi
36 > >
37 > > Sounds like you're introducing breakage, then abusing a function to fix
38 > > your breakage, then killing a useful diagnostic because you've just
39 > > broken it.
40 >
41 > I'm unable to make sense of what you are trying to say here. Is there
42 > something wrong with this patch, or are you making a general comment
43 > on the patch series?
44 >
45
46 Original usage: rewrite 'python' to 'pythonX.Y', etc. on static files.
47 Throws an error if you try to use for files that have correct shebang
48 already.
49
50 Now:
51
52 1. Due to PYTHON override, generated files frequently have wrong
53 shebangs.
54
55 2. python_fix_shebang is modified to fix this -- orthogonal behavior is
56 introduced.
57
58 3. Now diagnostic on files with correct shebang is gone because it
59 conflicts with the orthogonal behavior added here.
60
61 --
62 Best regards,
63 Michał Górny

Attachments

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

Replies