From a831745389fc8bdab60d661e7fffe2729522f738 Mon Sep 17 00:00:00 2001 From: Zamir SUN Date: Wed, 7 Aug 2019 23:04:38 +0800 Subject: [PATCH] Fix more python2 residuals. Fixes 1738158 --- ...ge-the-way-of-getting-python-ldflags.patch | 36 +++++++++++++++++++ trace-cmd.spec | 10 ++++-- 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 0003-change-the-way-of-getting-python-ldflags.patch diff --git a/0003-change-the-way-of-getting-python-ldflags.patch b/0003-change-the-way-of-getting-python-ldflags.patch new file mode 100644 index 0000000..1e2493d --- /dev/null +++ b/0003-change-the-way-of-getting-python-ldflags.patch @@ -0,0 +1,36 @@ +From c7e94b0d5d654162851bd6f62ed535c8721091e3 Mon Sep 17 00:00:00 2001 +From: Zamir SUN +Date: Sun, 4 Feb 2018 11:20:14 +0800 +Subject: trace-cmd: Change the way of getting python ldflags. + +Prior than this patch, Makefile detects python ldflags using a hardcoded +python command. It will cause problems if we are building against +python3 in the future when ldflags for python2 and python3 are +different. With this patch, python ldflags are detected by +corresponding python{,3}-config which will detect the right config for +python plugins. + +Link: http://lkml.kernel.org/r/20180204032014.6962-3-sztsian@gmail.com + +Signed-off-by: Zamir SUN (Red Hat) +Signed-off-by: Steven Rostedt (VMware) +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 6b0c3c5..f9b7f65 100644 +--- a/Makefile ++++ b/Makefile +@@ -642,7 +642,7 @@ report_noswig: force + + PYTHON_INCLUDES = `pkg-config --cflags $(PYTHON_VERS)` + PYTHON_LDFLAGS = `pkg-config --libs $(PYTHON_VERS)` \ +- $(shell python2 -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('LINKFORSHARED')") ++ $(shell $(PYTHON_VERS)-config --ldflags) + PYGTK_CFLAGS = `pkg-config --cflags pygtk-2.0` + + ctracecmd.so: $(TCMD_LIB_OBJS) ctracecmd.i +-- +2.21.0 + diff --git a/trace-cmd.spec b/trace-cmd.spec index a525e1c..bfaa45e 100644 --- a/trace-cmd.spec +++ b/trace-cmd.spec @@ -4,7 +4,7 @@ Name: trace-cmd Version: 2.7 -Release: 6%{?dist} +Release: 7%{?dist} License: GPLv2 and LGPLv2 Summary: A user interface to Ftrace @@ -17,6 +17,7 @@ Source0: https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git/s Source1: kernelshark.desktop Patch1: 0001-trace-cmd-Figure-out-the-arch-and-install-library-to.patch Patch2: 0002-trace-cmd-Fix-the-logic-behind-SWIG_DEFINED-in-the-M.patch +Patch3: 0003-change-the-way-of-getting-python-ldflags.patch BuildRequires: gcc BuildRequires: xmlto BuildRequires: asciidoc @@ -53,6 +54,7 @@ Python plugin support for trace-cmd %setup -q -n %{name}-v%{version} %patch1 -p1 %patch2 -p1 +%patch3 -p1 %build # MANPAGE_DOCBOOK_XSL define is hack to avoid using locate @@ -60,7 +62,7 @@ MANPAGE_DOCBOOK_XSL=`rpm -ql docbook-style-xsl | grep manpages/docbook.xsl` make V=1 CFLAGS="%{optflags} -D_GNU_SOURCE" LDFLAGS="%{build_ldflags}" \ MANPAGE_DOCBOOK_XSL=$MANPAGE_DOCBOOK_XSL prefix=%{_prefix} \ PYTHON_VERS=python3 all doc gui python-plugin - +sed -i 's/env python2/python3/g' event-viewer.py %install make V=1 DESTDIR=%{buildroot}/ prefix=%{_prefix} install install_doc install_gui install_python @@ -107,6 +109,10 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/kernelshark.desktop %changelog +* Wed Aug 07 2019 Zamir SUN - 2.7-7 +- Fix more python2 residuals. +- Fixes 1738158 + * Sat Aug 03 2019 Zamir SUN - 2.7-6 - Switch the python plugin to python3