1 |
On Sat, 2019-01-05 at 21:38 +0000, James Le Cuirot wrote: |
2 |
> On Fri, 04 Jan 2019 19:26:34 +0100 |
3 |
> Michał Górny <mgorny@g.o> wrote: |
4 |
> |
5 |
> > On Fri, 2019-01-04 at 13:10 -0500, Mike Gilbert wrote: |
6 |
> > > On Fri, Jan 4, 2019 at 10:55 AM Michał Górny <mgorny@g.o> wrote: |
7 |
> > > > |
8 |
> > > > On Thu, 2019-01-03 at 21:39 +0000, James Le Cuirot wrote: |
9 |
> > > > > Shebangs may need fixing on prefix systems or when cross-building but |
10 |
> > > > > not at other times. |
11 |
> > > > > |
12 |
> > > > > Signed-off-by: James Le Cuirot <chewi@g.o> |
13 |
> > > > > --- |
14 |
> > > > > eclass/python-utils-r1.eclass | 8 ++------ |
15 |
> > > > > 1 file changed, 2 insertions(+), 6 deletions(-) |
16 |
> > > > > |
17 |
> > > > > diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass |
18 |
> > > > > index 19cfaf2798ab..91e457f3cf14 100644 |
19 |
> > > > > --- a/eclass/python-utils-r1.eclass |
20 |
> > > > > +++ b/eclass/python-utils-r1.eclass |
21 |
> > > > > @@ -1328,16 +1328,12 @@ python_fix_shebang() { |
22 |
> > > > > fi |
23 |
> > > > > done < <(find -H "${path}" -type f -print0 || die) |
24 |
> > > > > |
25 |
> > > > > - if [[ ! ${any_fixed} ]]; then |
26 |
> > > > > + if [[ ! ${any_fixed} && ! ${any_correct} ]]; then |
27 |
> > > > > local cmd=eerror |
28 |
> > > > > [[ ${EAPI:-0} == [012345] ]] && cmd=eqawarn |
29 |
> > > > > |
30 |
> > > > > "${cmd}" "QA warning: ${FUNCNAME}, ${path#${D%/}} did not match any fixable files." |
31 |
> > > > > - if [[ ${any_correct} ]]; then |
32 |
> > > > > - "${cmd}" "All files have ${EPYTHON} shebang already." |
33 |
> > > > > - else |
34 |
> > > > > - "${cmd}" "There are no Python files in specified directory." |
35 |
> > > > > - fi |
36 |
> > > > > + "${cmd}" "There are no Python files in specified directory." |
37 |
> > > > > |
38 |
> > > > > [[ ${cmd} == eerror ]] && die "${FUNCNAME} did not match any fixable files (QA warning fatal in EAPI ${EAPI})" |
39 |
> > > > > fi |
40 |
> > > > |
41 |
> > > > Sounds like you're introducing breakage, then abusing a function to fix |
42 |
> > > > your breakage, then killing a useful diagnostic because you've just |
43 |
> > > > broken it. |
44 |
> > > |
45 |
> > > I'm unable to make sense of what you are trying to say here. Is there |
46 |
> > > something wrong with this patch, or are you making a general comment |
47 |
> > > on the patch series? |
48 |
> > > |
49 |
> > |
50 |
> > Original usage: rewrite 'python' to 'pythonX.Y', etc. on static files. |
51 |
> > Throws an error if you try to use for files that have correct shebang |
52 |
> > already. |
53 |
> > |
54 |
> > Now: |
55 |
> > |
56 |
> > 1. Due to PYTHON override, generated files frequently have wrong |
57 |
> > shebangs. |
58 |
> > |
59 |
> > 2. python_fix_shebang is modified to fix this -- orthogonal behavior is |
60 |
> > introduced. |
61 |
> > |
62 |
> > 3. Now diagnostic on files with correct shebang is gone because it |
63 |
> > conflicts with the orthogonal behavior added here. |
64 |
> |
65 |
> The diagnostic is a problem even without my changes. |
66 |
> |
67 |
> It's quite likely upstream could hardcode a shebang like |
68 |
> #!/usr/bin/python2.7, which does not need to be modified on normal |
69 |
> systems but does on prefixed systems. |
70 |
|
71 |
Fixing prefix was never the goal. |
72 |
|
73 |
> |
74 |
> What about hardcoding #!/usr/bin/python3.6? This would need correcting |
75 |
> against 3.7 but would fall foul of the diagnostic when using 3.6. |
76 |
|
77 |
No, it would fail as mismatched shebang. By design. |
78 |
|
79 |
python_fix_shebang is meant to fix common cases of generic shebangs |
80 |
in a safe way, not serve as a generic shebang replacement tool. |
81 |
|
82 |
-- |
83 |
Best regards, |
84 |
Michał Górny |