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

login
register
mail settings
Submitter Lee Jones
Date June 1, 2010, 5:05 p.m.
Message ID <4C053DCB.3020805@canonical.com>
Download mbox | patch
Permalink /patch/54267/
State Accepted
Delegated to: Leann Ogasawara
Headers show

Comments

Lee Jones - June 1, 2010, 5:05 p.m.
commit 8a2775c937d9349e8c7ccb915a3d2b134c13f09b
Author: Lee Jones <lee.jones@canonical.com>
Date:   Tue May 25 11:49:32 2010 +0100

    UBUNTU: Enable perf to be more helpful when perf_<version> does not exist.
   
    BugLink: http://bugs.launchpad.net/bugs/570500
   
    Signed-off-by: Lee Jones <lee.jones@canonical.com>
Leann Ogasawara - June 7, 2010, 8:53 p.m.
Applied to Maverick master.

Thanks,
Leann

Patch

diff --git a/debian/tools/perf b/debian/tools/perf
index 79253d2..ab35fab 100644 (file)
--- 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" "$@"