[PATCH v3 for-next] pm: cpupower: rename raw_pylibcpupower.i

Min-Hua Chen posted 1 patch 2 months, 2 weeks ago
tools/power/cpupower/bindings/python/Makefile                 | 4 ++--
.../python/{raw_pylibcpupower.i => raw_pylibcpupower.swg}     | 0
2 files changed, 2 insertions(+), 2 deletions(-)
rename tools/power/cpupower/bindings/python/{raw_pylibcpupower.i => raw_pylibcpupower.swg} (100%)
[PATCH v3 for-next] pm: cpupower: rename raw_pylibcpupower.i
Posted by Min-Hua Chen 2 months, 2 weeks ago
The raw_pylibcpupower.i is removed unexpectedly after 'make mrproper'

We can reproduce the error by performing the following steps:
cd linux-next
make mrproper
cd tools/power/cpupower/bindings/python
make

We will get an error message:
make: *** No rule to make target 'raw_pylibcpupower.i', needed by 'raw_pylibcpupower_wrap.c'.  Stop.

The root cause:

The *.i files are already used for pre-processor output files and
the kernel removes all the *.i files by 'make mrproper'.

That explains why the raw_pylibcpupower.i is removed by 'make mrproper'.

To fix it, Follow John's suggestion to rename raw_pylibcpupower.i to
raw_pylibcpupower.swg.

See:
https://www.swig.org/Doc4.2/SWIG.html

Reviewed-by: John B. Wyatt IV <jwyatt@redhat.com>
Reviewed-by: John B. Wyatt IV <sageofredondo@gmail.com>
Tested-by: John B. Wyatt IV <jwyatt@redhat.com>
Tested-by: John B. Wyatt IV <sageofredondo@gmail.com>
Signed-off-by: Min-Hua Chen <minhuadotchen@gmail.com>

---

change since v1:
build a non-frc patch
change since v2:
follow the document to rename *.if to *.swg 

---
 tools/power/cpupower/bindings/python/Makefile                 | 4 ++--
 .../python/{raw_pylibcpupower.i => raw_pylibcpupower.swg}     | 0
 2 files changed, 2 insertions(+), 2 deletions(-)
 rename tools/power/cpupower/bindings/python/{raw_pylibcpupower.i => raw_pylibcpupower.swg} (100%)

diff --git a/tools/power/cpupower/bindings/python/Makefile b/tools/power/cpupower/bindings/python/Makefile
index dc09c5b66ead..e1ebb1d60cd4 100644
--- a/tools/power/cpupower/bindings/python/Makefile
+++ b/tools/power/cpupower/bindings/python/Makefile
@@ -20,13 +20,13 @@ _raw_pylibcpupower.so: raw_pylibcpupower_wrap.o
 raw_pylibcpupower_wrap.o: raw_pylibcpupower_wrap.c
 	$(CC) -fPIC -c raw_pylibcpupower_wrap.c $(PY_INCLUDE)
 
-raw_pylibcpupower_wrap.c: raw_pylibcpupower.i
+raw_pylibcpupower_wrap.c: raw_pylibcpupower.swg
 ifeq ($(HAVE_SWIG),0)
 	$(error "swig was not found. Make sure you have it installed and in the PATH to generate the bindings.")
 else ifeq ($(HAVE_PYCONFIG),0)
 	$(error "python-config was not found. Make sure you have it installed and in the PATH to generate the bindings.")
 endif
-	swig -python raw_pylibcpupower.i
+	swig -python raw_pylibcpupower.swg
 
 # Will only clean the bindings folder; will not clean the actual cpupower folder
 clean:
diff --git a/tools/power/cpupower/bindings/python/raw_pylibcpupower.i b/tools/power/cpupower/bindings/python/raw_pylibcpupower.swg
similarity index 100%
rename from tools/power/cpupower/bindings/python/raw_pylibcpupower.i
rename to tools/power/cpupower/bindings/python/raw_pylibcpupower.swg
-- 
2.43.0
Re: [PATCH v3 for-next] pm: cpupower: rename raw_pylibcpupower.i
Posted by Shuah Khan 2 months, 2 weeks ago
On 9/13/24 14:17, Min-Hua Chen wrote:
> The raw_pylibcpupower.i is removed unexpectedly after 'make mrproper'
> 
> We can reproduce the error by performing the following steps:
> cd linux-next
> make mrproper
> cd tools/power/cpupower/bindings/python
> make
> 
> We will get an error message:
> make: *** No rule to make target 'raw_pylibcpupower.i', needed by 'raw_pylibcpupower_wrap.c'.  Stop.
> 
> The root cause:
> 
> The *.i files are already used for pre-processor output files and
> the kernel removes all the *.i files by 'make mrproper'.
> 
> That explains why the raw_pylibcpupower.i is removed by 'make mrproper'.
> 
> To fix it, Follow John's suggestion to rename raw_pylibcpupower.i to
> raw_pylibcpupower.swg.
> 
> See:
> https://www.swig.org/Doc4.2/SWIG.html
> 
> Reviewed-by: John B. Wyatt IV <jwyatt@redhat.com>
> Reviewed-by: John B. Wyatt IV <sageofredondo@gmail.com>
> Tested-by: John B. Wyatt IV <jwyatt@redhat.com>
> Tested-by: John B. Wyatt IV <sageofredondo@gmail.com>
> Signed-off-by: Min-Hua Chen <minhuadotchen@gmail.com>
> 
> ---
> 
> change since v1:
> build a non-frc patch
> change since v2:
> follow the document to rename *.if to *.swg
> 

Thank you Min for finding the problem and working with us
to fix it.

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux.git/log/?h=cpupower

Please note that this will be sent to PM maintainer in my next pull
request. This might be after the merge window.

thanks,
-- Shuah