]> git.pld-linux.org Git - packages/kernel-tools.git/commitdiff
A wrapper 'perf' script added
authorJacek Konieczny <j.konieczny@eggsoft.pl>
Wed, 26 Feb 2014 09:57:21 +0000 (10:57 +0100)
committerJacek Konieczny <j.konieczny@eggsoft.pl>
Wed, 26 Feb 2014 09:57:21 +0000 (10:57 +0100)
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
perf [new file with mode: 0644]

index d86d0b5bbf60078d3df9c882ea8d33f4201527d2..7ff4ae168917726fe4fb410285d36acd89e287a3 100644 (file)
@@ -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 (file)
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
This page took 0.184075 seconds and 4 git commands to generate.