perf: Correct the substitution of python shebangs
PATCH 1/1 perf: Correct the substitution of python shebangs
From: He Zhe <[email protected]>
To make the native python3 are always used,
- Move the substitution of /usr/bin/python3 to first, otherwise the possible original /usr/bin/python3 would be changed to /usr/bin/env python33.
- Add substitution for ${S}/scripts/
--- meta/recipes-kernel/perf/perf.bb | 7 +++++++ 1 file changed, 7 insertions(+)
meta/recipes-kernel/perf/perf.bb +7 -0
@@ -240,10 +240,17 @@ do_configure_prepend () { # use /usr/bin/env instead of version specific python for s in `find ${S}/tools/perf/ -name '*.py'`; do + sed -i 's,/usr/bin/python3,/usr/bin/env python3,' "${s}" sed -i 's,/usr/bin/python,/usr/bin/env python3,' "${s}" sed -i 's,/usr/bin/python2,/usr/bin/env python3,' "${s}" sed -i 's,/usr/bin/env python2,/usr/bin/env python3,' "${s}" + done + + for s in `find ${S}/scripts/ -name '*.py'`; do sed -i 's,/usr/bin/python3,/usr/bin/env python3,' "${s}" + sed -i 's,/usr/bin/python,/usr/bin/env python3,' "${s}" + sed -i 's,/usr/bin/python2,/usr/bin/env python3,' "${s}" + sed -i 's,/usr/bin/env python2,/usr/bin/env python3,' "${s}" done # unistd.h can be out of sync between libc-headers and the captured version in the perf source
Signature · 1 line
2.7.4
Thank you - works for me. I've been waiting for a fix!
Quoted 10 lines · On 2020-02-13 10:38 a.m., [email protected] wrote:
From: He Zhe <[email protected]>
To make the native python3 are always used,
- Move the substitution of
/usr/bin/python3to first, otherwise the possible original/usr/bin/python3would be changed to/usr/bin/envpython33.
- Add substitution for ${S}/scripts/Signed-off-by He Zhe <[email protected]>
Quoted 26 lines
--- meta/recipes-kernel/perf/perf.bb | 7 +++++++ 1 file changed, 7 insertions(+)meta/recipes-kernel/perf/perf.bb +7
-0@@ -240,10 +240,17 @@ do_configure_prepend () { # use /usr/bin/env instead of version specific python for s in `find ${S}/tools/perf/ -name '*.py'`; do + sed -i 's,/usr/bin/python3,/usr/bin/env python3,' "${s}" sed -i 's,/usr/bin/python,/usr/bin/env python3,' "${s}" sed -i 's,/usr/bin/python2,/usr/bin/env python3,' "${s}" sed -i 's,/usr/bin/env python2,/usr/bin/env python3,' "${s}" + done + + for s in `find ${S}/scripts/ -name '*.py'`; do sed -i 's,/usr/bin/python3,/usr/bin/env python3,' "${s}" + sed -i 's,/usr/bin/python,/usr/bin/env python3,' "${s}" + sed -i 's,/usr/bin/python2,/usr/bin/env python3,' "${s}" + sed -i 's,/usr/bin/env python2,/usr/bin/env python3,' "${s}" done # unistd.h can be out of sync between libc-headers and the captured version in the perf source
Quoted 5 lines · On Thu, Feb 13, 2020 at 1:39 PM <[email protected]> wrote:
From: He Zhe <[email protected]>
To make the native python3 are always used,
FWIW, a very similar patch was sent 10 days ago. Did you confirm that it isn't in master-next already ?
see: "[OE-core] [PATCH] perf: Additional fixes for 5.5+"
Bruce
Quoted 40 lines
- Move the substitution of
/usr/bin/python3to first, otherwise the possible original/usr/bin/python3would be changed to/usr/bin/envpython33.
- Add substitution for ${S}/scripts/Signed-off-by He Zhe <[email protected]>--- meta/recipes-kernel/perf/perf.bb | 7 +++++++ 1 file changed, 7 insertions(+)meta/recipes-kernel/perf/perf.bb +7
-1@@ -240,10 +240,17 @@ do_configure_prepend () { # use /usr/bin/env instead of version specific python for s in `find ${S}/tools/perf/ -name '*.py'`; do + sed -i 's,/usr/bin/python3,/usr/bin/env python3,' "${s}" sed -i 's,/usr/bin/python,/usr/bin/env python3,' "${s}" sed -i 's,/usr/bin/python2,/usr/bin/env python3,' "${s}" sed -i 's,/usr/bin/env python2,/usr/bin/env python3,' "${s}" + done + + for s in `find ${S}/scripts/ -name '*.py'`; do sed -i 's,/usr/bin/python3,/usr/bin/env python3,' "${s}" + sed -i 's,/usr/bin/python,/usr/bin/env python3,' "${s}" + sed -i 's,/usr/bin/python2,/usr/bin/env python3,' "${s}" + sed -i 's,/usr/bin/env python2,/usr/bin/env python3,' "${s}" done # unistd.h can be out of sync between libc-headers and the captured version in the perf source --2.7.4
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end - "Use the force Harry" - Gandalf, Star Trek II
Quoted 7 lines · Bruce Ashfield
Quoted 4 lines · On Thu, Feb 13, 2020 at 1:39 PM <[email protected]> wrote:
From: He Zhe <[email protected]>
To make the native python3 are always used,
FWIW, a very similar patch was sent 10 days ago. Did you confirm that it isn't in master-next already ?
It's not in master-next as far as I can tell.
Quoted 47 lines
see: "[OE-core] [PATCH] perf: Additional fixes for 5.5+"
Bruce
Quoted 40 lines
- Move the substitution of
/usr/bin/python3to first, otherwise the possible original/usr/bin/python3would be changed to/usr/bin/envpython33.
- Add substitution for ${S}/scripts/Signed-off-by He Zhe <[email protected]>--- meta/recipes-kernel/perf/perf.bb | 7 +++++++ 1 file changed, 7 insertions(+)meta/recipes-kernel/perf/perf.bb +7
-1@@ -240,10 +240,17 @@ do_configure_prepend () { # use /usr/bin/env instead of version specific python for s in `find ${S}/tools/perf/ -name '*.py'`; do + sed -i 's,/usr/bin/python3,/usr/bin/env python3,' "${s}" sed -i 's,/usr/bin/python,/usr/bin/env python3,' "${s}" sed -i 's,/usr/bin/python2,/usr/bin/env python3,' "${s}" sed -i 's,/usr/bin/env python2,/usr/bin/env python3,' "${s}" + done + + for s in `find ${S}/scripts/ -name '*.py'`; do sed -i 's,/usr/bin/python3,/usr/bin/env python3,' "${s}" + sed -i 's,/usr/bin/python,/usr/bin/env python3,' "${s}" + sed -i 's,/usr/bin/python2,/usr/bin/env python3,' "${s}" + sed -i 's,/usr/bin/env python2,/usr/bin/env python3,' "${s}" done # unistd.h can be out of sync between libc-headers and the captured version in the perf source --2.7.4
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Quoted 20 lines · On Thu, Feb 13, 2020 at 1:39 PM <[email protected]> wrote:
From: He Zhe <[email protected]>
To make the native python3 are always used,
- Move the substitution of
/usr/bin/python3to first, otherwise the possible original/usr/bin/python3would be changed to/usr/bin/envpython33.
- Add substitution for ${S}/scripts/Signed-off-by He Zhe <[email protected]>--- meta/recipes-kernel/perf/perf.bb | 7 +++++++ 1 file changed, 7 insertions(+)meta/recipes-kernel/perf/perf.bb +0
-0
meta/recipes-kernel/perf/perf.bb do_configure_prepend () { · line 243
Quoted 4 lines
meta/recipes-kernel/perf/perf.bb +1
-0@@ -240,10 +240,17 @@ do_configure_prepend () { # use /usr/bin/env instead of version specific python for s in `find ${S}/tools/perf/ -name '*.py'`; do + sed -i 's,/usr/bin/python3,/usr/bin/env python3,' "${s}"
Rather than messing around with the order of these, we should just combine them into a single sed invocation. When I started those substitutions, there weren't so many.
As was mentioned in the other perf patch and review:
sed -i -e "1s,#!.*python.*,#!${USRBINPATH}/env python3," ${s}
or some variant of the regex should fix them all.
meta/recipes-kernel/perf/perf.bb do_configure_prepend () { · line 249
Quoted 6 lines
meta/recipes-kernel/perf/perf.bb +3
-0sed -i 's,/usr/bin/python,/usr/bin/env python3,' "${s}" sed -i 's,/usr/bin/python2,/usr/bin/env python3,' "${s}" sed -i 's,/usr/bin/env python2,/usr/bin/env python3,' "${s}" + done + + for s in `find ${S}/scripts/ -name '*.py'`; do
It would be better to not have two loops doing the same thing, why not combine the two ? In the other review, the single script that was causing the problem was specifically pointed out .. and while I also agree that we can just substitute them all, technically, if we haven't run them, we don't know they are py3 safe.
But minimally, getting them into a single for loop is something we should do (also part of that other patch/review).
Bruce
Quoted 10 lines
meta/recipes-kernel/perf/perf.bb +3
-1sed -i 's,/usr/bin/python3,/usr/bin/env python3,' "${s}" + sed -i 's,/usr/bin/python,/usr/bin/env python3,' "${s}" + sed -i 's,/usr/bin/python2,/usr/bin/env python3,' "${s}" + sed -i 's,/usr/bin/env python2,/usr/bin/env python3,' "${s}" done # unistd.h can be out of sync between libc-headers and the captured version in the perf source --2.7.4
Quoted 5 lines
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
Thanks for your input.
Since the old one doesn't make it to next branch and the thread hasn't had following replies, I'll send v2 as a summary.
Zhe
Quoted 70 lines · Bruce Ashfield
Quoted 19 lines · On Thu, Feb 13, 2020 at 1:39 PM <[email protected]> wrote:
From: He Zhe <[email protected]>
To make the native python3 are always used,
- Move the substitution of
/usr/bin/python3to first, otherwise the possible original/usr/bin/python3would be changed to/usr/bin/envpython33.
- Add substitution for ${S}/scripts/Signed-off-by He Zhe <[email protected]>--- meta/recipes-kernel/perf/perf.bb | 7 +++++++ 1 file changed, 7 insertions(+)meta/recipes-kernel/perf/perf.bb +0
-0meta/recipes-kernel/perf/perf.bb do_configure_prepend () { · line 243
Quoted 4 lines
meta/recipes-kernel/perf/perf.bb +1
-0@@ -240,10 +240,17 @@ do_configure_prepend () { # use /usr/bin/env instead of version specific python for s in `find ${S}/tools/perf/ -name '*.py'`; do + sed -i 's,/usr/bin/python3,/usr/bin/env python3,' "${s}"Rather than messing around with the order of these, we should just combine them into a single sed invocation. When I started those substitutions, there weren't so many.
As was mentioned in the other perf patch and review:
sed -i -e "1s,#!.*python.*,#!${USRBINPATH}/env python3," ${s}
or some variant of the regex should fix them all.
meta/recipes-kernel/perf/perf.bb do_configure_prepend () { · line 249
Quoted 6 lines
meta/recipes-kernel/perf/perf.bb +3
-0sed -i 's,/usr/bin/python,/usr/bin/env python3,' "${s}" sed -i 's,/usr/bin/python2,/usr/bin/env python3,' "${s}" sed -i 's,/usr/bin/env python2,/usr/bin/env python3,' "${s}" + done + + for s in `find ${S}/scripts/ -name '*.py'`; doIt would be better to not have two loops doing the same thing, why not combine the two ? In the other review, the single script that was causing the problem was specifically pointed out .. and while I also agree that we can just substitute them all, technically, if we haven't run them, we don't know they are py3 safe.
But minimally, getting them into a single for loop is something we should do (also part of that other patch/review).
Bruce
Quoted 10 lines
meta/recipes-kernel/perf/perf.bb +3
-1sed -i 's,/usr/bin/python3,/usr/bin/env python3,' "${s}" + sed -i 's,/usr/bin/python,/usr/bin/env python3,' "${s}" + sed -i 's,/usr/bin/python2,/usr/bin/env python3,' "${s}" + sed -i 's,/usr/bin/env python2,/usr/bin/env python3,' "${s}" done # unistd.h can be out of sync between libc-headers and the captured version in the perf source --2.7.4
Quoted 5 lines
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II