[PATCH] UBUNTU: Enable perf to be more helpful when perf_<version> does not exist.

Lee Jones lee.jones at canonical.com
Tue May 25 14:34:52 BST 2010


All,

I received this bug yesterday where a user has run 'perf' and received an error similar to "command not found", without any clue as to what exactly has failed. The user submitted a patch which he thought might be helpful to ensure perf behaves a little better and is a little more forthcoming in the future. I have cleaned it up and changed a few bits and pieces. Here is the result:

http://bugs.launchpad.net/bugs/570500

Signed-off-by: Lee Jones <lee.jones at canonical.com>
---
 debian/tools/perf |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/debian/tools/perf b/debian/tools/perf
index 79253d2..ab35fab 100644
--- a/debian/tools/perf
+++ b/debian/tools/perf
@@ -1,7 +1,16 @@
 #!/bin/bash
-version=`uname -r`
-flavour=${version#*-}
-flavour=${flavour#*-}
-version=${version%-$flavour}
+full_version=`uname -r`
 
-exec "perf_$version" "$@"
+# Removing flavour from version i.e. generic or server.
+flavour_abi=${full_version#*-}
+flavour=${flavour_abi#*-}
+version=${full_version%-$flavour}
+perf="perf_$version"
+
+if ! which "$perf" > /dev/null; then
+    echo "$perf not found" >&2
+    echo "You may need to install linux-tools-$version" >&2
+    exit 2
+fi
+
+exec "$perf" "$@"

Kind regards,
Lee (lag) <- awaits flogging


-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/kernel-team/attachments/20100525/846bf6ab/attachment.htm 


More information about the kernel-team mailing list