[PATCH] UBUNTU: Enable perf to be more helpful when perf_<version> does not exist.
Stefan Bader
stefan.bader at canonical.com
Tue Jun 1 13:43:48 UTC 2010
On 06/01/2010 12:47 PM, Lee Jones wrote:
>
>> The pull request is correct. For most patches (except the truly
>> gargantuan ones) I attach or inline so that patchwork detects it as a
>> patch which makes the release maintainers job easier.
>
> commit 8a2775c937d9349e8c7ccb915a3d2b134c13f09b
> Author: Lee Jones <lee.jones at canonical.com>
> Date: Tue May 25 11:49:32 2010 +0100
>
> UBUNTU: Enable perf to be more helpful when perf_<version> does not
> exist.
>
> http://bugs.launchpad.net/bugs/570500
>
> Signed-off-by: Lee Jones <lee.jones at canonical.com>
>
>
> 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}
I think those are the merits of that oh so understandable and clear shell
syntax. Clearly ${...#word} removes the shortest prefix while ${...##word}
removes the longest match. :-)
But the comments help imo.
-Stefan
> +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" "$@"
>
> Hopefully this is better.
>
> Kind regards,
> Lee
>
More information about the kernel-team
mailing list