From patchwork Tue May 25 13:34:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 53543 X-Patchwork-Delegate: apw@canonical.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id D1180B7D1D for ; Tue, 25 May 2010 23:35:06 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1OGuHY-0000jl-FP; Tue, 25 May 2010 14:34:56 +0100 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1OGuHX-0000ja-02 for kernel-team@lists.ubuntu.com; Tue, 25 May 2010 14:34:55 +0100 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1OGuHW-0007D8-Rh for ; Tue, 25 May 2010 14:34:54 +0100 Received: from cpc2-aztw21-0-0-cust264.aztw.cable.virginmedia.com ([77.100.97.9] helo=[192.168.0.131]) by hutte.canonical.com with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1OGuHW-0003mY-NN for kernel-team@lists.ubuntu.com; Tue, 25 May 2010 14:34:54 +0100 Message-ID: <4BFBD1FC.90103@canonical.com> Date: Tue, 25 May 2010 14:34:52 +0100 From: Lee Jones User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100423 Thunderbird/3.0.4 MIME-Version: 1.0 To: kernel-team Subject: [PATCH] UBUNTU: Enable perf to be more helpful when perf_ does not exist. X-Enigmail-Version: 1.0.1 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Mime-version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com 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 --- debian/tools/perf | 19 ++++++++++++++----- 1 files changed, 14 insertions(+), 5 deletions(-) Kind regards, Lee (lag) <- awaits flogging 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" "$@"