[packages/kernel-tools] A wrapper 'perf' script added

jajcus jajcus at pld-linux.org
Wed Feb 26 10:58:15 CET 2014


commit 35be64663d1a37d9e3bb82f7b3f92741110b43c5
Author: Jacek Konieczny <j.konieczny at eggsoft.pl>
Date:   Wed Feb 26 10:57:21 2014 +0100

    A wrapper 'perf' script added
    
    One may expect 'perf' command to be working, no matter if SLang or GTK
    perf build is installed. This simple wrapper will make it work.

 kernel-tools.spec |  6 +++++-
 perf              | 19 +++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)
---
diff --git a/kernel-tools.spec b/kernel-tools.spec
index d86d0b5..7ff4ae1 100644
--- a/kernel-tools.spec
+++ b/kernel-tools.spec
@@ -10,7 +10,7 @@
 %bcond_without	perf		# perf tools
 %bcond_without	gtk		# gtk perf version
 
-%define		rel		2
+%define		rel		3
 %define		basever		3.10
 %define		postver		.27
 Summary:	Assortment of tools for the Linux kernel
@@ -28,6 +28,7 @@ Patch0:		http://www.kernel.org/pub/linux/kernel/v3.x/patch-%{version}.xz
 %endif
 Source1:	cpupower.service
 Source2:	cpupower.config
+Source3:	perf
 URL:		http://www.kernel.org/
 BuildRequires:	gettext-tools
 BuildRequires:	pciutils-devel
@@ -374,6 +375,8 @@ PWD=${PWD:-$(pwd)}
 %py_ocomp $RPM_BUILD_ROOT%{_datadir}/perf-core/scripts/python
 
 rm -r $RPM_BUILD_ROOT%{_datadir}/perf-core/tests
+
+install %{SOURCE3} $RPM_BUILD_ROOT%{_bindir}/perf
 %endif
 
 # gen_init_cpio
@@ -431,6 +434,7 @@ rm -rf $RPM_BUILD_ROOT
 %if %{with perf}
 %files perf-core
 %defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/perf
 %{_mandir}/man1/perf*.1*
 %dir %{_datadir}/perf-core
 %attr(755,root,root) %{_datadir}/perf-core/perf-archive
diff --git a/perf b/perf
new file mode 100644
index 0000000..af12741
--- /dev/null
+++ b/perf
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+if [ -x /usr/bin/perf_gtk -a -n "$DISPLAY" ] ; then
+	# prefer GTK version under X11
+	exec /usr/bin/perf_gtk "$@"
+fi
+if [ -x /usr/bin/perf_slang ] ; then
+	# use text version if perf_gtk or $DISPLAY is not available
+	exec /usr/bin/perf_slang "$@"
+fi
+if [ -x /usr/bin/perf_gtk ] ; then
+	# fall-back to perf_gtk if no perf_slang (it can work in a terminal
+	# too)
+	exec /usr/bin/perf_gtk "$@"
+fi
+
+echo "You need 'kernel-tools-perf-gtk' or 'kernel-tools-perf-slang' package installed!"
+
+exit 1
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/kernel-tools.git/commitdiff/35be64663d1a37d9e3bb82f7b3f92741110b43c5



More information about the pld-cvs-commit mailing list