Skip to contentSkip to conversation

perf: python: Fix build when PYTHON_CONFIG is user supplied

PATCH Applied James Clark 3 participants 5 messages Jul 28, 2022 – Aug 22, 2022 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf: python: Fix build when PYTHON_CONFIG is user supplied

The previous change to Python autodetection had a small mistake where the auto value was used to determine the Python binary, rather than the user supplied value. The Python binary is only used for one part of the build process, rather than the final linking, so it was producing correct builds in most scenarios, especially when the auto detected value matched what the user wanted, or the system only had a valid set of Pythons.

Change it so that the Python binary path is derived from either the PYTHON_CONFIG value or PYTHON value, depending on what is specified by the user. This was the original intention.

This error was spotted in a build failure an odd cross compilation environment after commit 4c41cb46a732fe82 ("perf python: Prefer python3") was merged.

Fixes 630af16eee495f58 ("perf tools: Use Python devtools for version autodetection rather than runtime")
---
 tools/perf/Makefile.config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.config +1 -1
index d3c254c0f5c6..a69da9f34486 100644
@@ -265,7 +265,7 @@ endif
 # defined. get-executable-or-default fails with an error if the first argument is supplied but
 # doesn't exist.
 override PYTHON_CONFIG := $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON_AUTO))
-override PYTHON := $(call get-executable-or-default,PYTHON,$(subst -config,,$(PYTHON_AUTO)))
+override PYTHON := $(call get-executable-or-default,PYTHON,$(subst -config,,$(PYTHON_CONFIG)))
 
 grep-libs  = $(filter -l%,$(1))
 strip-libs  = $(filter-out -l%,$(1))
Signature · 1 line
2.28.0
reviewer Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines · James Clark

The previous change to Python autodetection had a small mistake where the auto value was used to determine the Python binary, rather than the user supplied value. The Python binary is only used for one part of the build process, rather than the final linking, so it was producing correct builds in most scenarios, especially when the auto detected value matched what the user wanted, or the system only had a valid set of Pythons.

Change it so that the Python binary path is derived from either the PYTHON_CONFIG value or PYTHON value, depending on what is specified by the user. This was the original intention.

Quoted 6 lines

This error was spotted in a build failure an odd cross compilation environment after commit 4c41cb46a732fe82 ("perf python: Prefer python3") was merged.

Fixes 630af16eee495f58 ("perf tools: Use Python devtools for version autodetection rather than runtime")

Thanks,
Ian

Quoted 20 lines
---
 tools/perf/Makefile.config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.config +1 -2
index d3c254c0f5c6..a69da9f34486 100644
@@ -265,7 +265,7 @@ endif
 # defined. get-executable-or-default fails with an error if the first argument is supplied but
 # doesn't exist.
 override PYTHON_CONFIG := $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON_AUTO))
-override PYTHON := $(call get-executable-or-default,PYTHON,$(subst -config,,$(PYTHON_AUTO)))
+override PYTHON := $(call get-executable-or-default,PYTHON,$(subst -config,,$(PYTHON_CONFIG)))
 
 grep-libs  = $(filter -l%,$(1))
 strip-libs  = $(filter-out -l%,$(1))
--

2.28.0

maintainer Applied
#2 lore raw

Em Thu, Jul 28, 2022 at 09:37:32AM -0700, Ian Rogers escreveu:

Quoted 14 lines · James Clark
Quoted 13 lines

The previous change to Python autodetection had a small mistake where the auto value was used to determine the Python binary, rather than the user supplied value. The Python binary is only used for one part of the build process, rather than the final linking, so it was producing correct builds in most scenarios, especially when the auto detected value matched what the user wanted, or the system only had a valid set of Pythons.

Change it so that the Python binary path is derived from either the PYTHON_CONFIG value or PYTHON value, depending on what is specified by the user. This was the original intention.

Quoted 8 lines
Quoted 6 lines

This error was spotted in a build failure an odd cross compilation environment after commit 4c41cb46a732fe82 ("perf python: Prefer python3") was merged.

Fixes 630af16eee495f58 ("perf tools: Use Python devtools for version autodetection rather than runtime")

Thanks, applied.

- Arnaldo

Quoted 23 lines

Thanks,
Ian

Quoted 20 lines
---
 tools/perf/Makefile.config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.config +1 -2
index d3c254c0f5c6..a69da9f34486 100644
@@ -265,7 +265,7 @@ endif
 # defined. get-executable-or-default fails with an error if the first argument is supplied but
 # doesn't exist.
 override PYTHON_CONFIG := $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON_AUTO))
-override PYTHON := $(call get-executable-or-default,PYTHON,$(subst -config,,$(PYTHON_AUTO)))
+override PYTHON := $(call get-executable-or-default,PYTHON,$(subst -config,,$(PYTHON_CONFIG)))
 
 grep-libs  = $(filter -l%,$(1))
 strip-libs  = $(filter-out -l%,$(1))
--

2.28.0

Signature · 1 line
- Arnaldo
#3 lore raw
Quoted 19 lines · Arnaldo Carvalho de Melo

Em Thu, Jul 28, 2022 at 09:37:32AM -0700, Ian Rogers escreveu:

Quoted 18 lines · James Clark
Quoted 17 lines

The previous change to Python autodetection had a small mistake where the auto value was used to determine the Python binary, rather than the user supplied value. The Python binary is only used for one part of the build process, rather than the final linking, so it was producing correct builds in most scenarios, especially when the auto detected value matched what the user wanted, or the system only had a valid set of Pythons.

Change it so that the Python binary path is derived from either the PYTHON_CONFIG value or PYTHON value, depending on what is specified by the user. This was the original intention.

This error was spotted in a build failure an odd cross compilation environment after commit 4c41cb46a732fe82 ("perf python: Prefer python3") was merged.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Fixes 630af16eee495f58 ("perf tools: Use Python devtools for version autodetection rather than runtime")

Thanks, applied.

Hi Arnaldo,

I couldn't find this change in any of your branches. Do you know if it got dropped somehow or was there an issue with it?

Thanks
James

Quoted 28 lines

- Arnaldo

Quoted 23 lines

Thanks,
Ian

Quoted 20 lines
---
 tools/perf/Makefile.config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.config +1 -2
index d3c254c0f5c6..a69da9f34486 100644
@@ -265,7 +265,7 @@ endif
 # defined. get-executable-or-default fails with an error if the first argument is supplied but
 # doesn't exist.
 override PYTHON_CONFIG := $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON_AUTO))
-override PYTHON := $(call get-executable-or-default,PYTHON,$(subst -config,,$(PYTHON_AUTO)))
+override PYTHON := $(call get-executable-or-default,PYTHON,$(subst -config,,$(PYTHON_CONFIG)))
 
 grep-libs  = $(filter -l%,$(1))
 strip-libs  = $(filter-out -l%,$(1))
--

2.28.0

#4 lore raw

Em Mon, Aug 22, 2022 at 11:08:37AM +0100, James Clark escreveu:

Quoted 25 lines · Arnaldo Carvalho de Melo
Quoted 22 lines

Em Thu, Jul 28, 2022 at 09:37:32AM -0700, Ian Rogers escreveu:

Quoted 21 lines · James Clark
Quoted 19 lines

The previous change to Python autodetection had a small mistake where the auto value was used to determine the Python binary, rather than the user supplied value. The Python binary is only used for one part of the build process, rather than the final linking, so it was producing correct builds in most scenarios, especially when the auto detected value matched what the user wanted, or the system only had a valid set of Pythons.

Change it so that the Python binary path is derived from either the PYTHON_CONFIG value or PYTHON value, depending on what is specified by the user. This was the original intention.

This error was spotted in a build failure an odd cross compilation environment after commit 4c41cb46a732fe82 ("perf python: Prefer python3") was merged.

Fixes 630af16eee495f58 ("perf tools: Use Python devtools for version autodetection rather than runtime")
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Thanks, applied.

Hi Arnaldo,

I couldn't find this change in any of your branches. Do you know if it got dropped somehow or was there an issue with it?

Applied it to my local perf/urgent branch, testing now. I thought I had processed it, not really :-\

- Arnaldo