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