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

Tim Gardner tim.gardner at canonical.com
Wed May 26 16:51:28 UTC 2010


On 05/25/2010 07:34 AM, Lee Jones wrote:
> 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
>
>
>
>

I think your patch is space/tab munged. Its probably best if you push to 
your public git repository and email a pull request.

rtg
-- 
Tim Gardner tim.gardner at canonical.com




More information about the kernel-team mailing list