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

login
register
mail settings
Submitter Lee Jones
Date May 25, 2010, 1:34 p.m.
Message ID <4BFBD1FC.90103@canonical.com>
Download mbox | patch
Permalink /patch/53543/
State Superseded
Delegated to: Andy Whitcroft
Headers show

Comments

Lee Jones - May 25, 2010, 1:34 p.m.
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@canonical.com>
---
 debian/tools/perf |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)


Kind regards,
Lee (lag) <- awaits flogging
Tim Gardner - May 26, 2010, 4:51 p.m.
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@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
Lee Jones - May 27, 2010, 10:24 a.m.
Hi Tim,

Is this what you need?

author         Lee Jones <lee.jones@canonical.com>
                   Tue, 25 May 2010 10:49:32 +0000 (11:49 +0100)
committer    Lee Jones <lee.jones@canonical.com>
                    Tue, 25 May 2010 10:49:32 +0000 (11:49 +0100)
commit        8a2775c937d9349e8c7ccb915a3d2b134c13f09b

Kind regards,
Lee
Tim Gardner - May 27, 2010, 1:27 p.m.
On 05/27/2010 04:24 AM, Lee Jones wrote:
> Hi Tim,
>
> Is this what you need?
>
> author         Lee Jones<lee.jones@canonical.com>
>                     Tue, 25 May 2010 10:49:32 +0000 (11:49 +0100)
> committer    Lee Jones<lee.jones@canonical.com>
>                      Tue, 25 May 2010 10:49:32 +0000 (11:49 +0100)
> commit        8a2775c937d9349e8c7ccb915a3d2b134c13f09b
>
> Kind regards,
> Lee
>

This section describes the syntax of a pull request:

https://wiki.ubuntu.com/KernelTeam/KernelSimpleGuide?highlight=(request\-pull)

rtg
Lee Jones - May 27, 2010, 3:05 p.m.
Hi Tim,

Is this the kind of thing you're after?

The following changes since commit f0819aaf4948e34a44d9d685615ddee74271cd70:
  Chase Douglas (1):
        UBUNTU: enforce CONFIG_TMPFS_POSIX_ACL=y

are available in the git repository at:

  git://kernel.ubuntu.com/lag/ubuntu-lucid.git lp570500

Lee Jones (1):
      UBUNTU: Enable perf to be more helpful when perf_<version> does
not exist.

 debian/tools/perf |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

Kind regards,
Lee
Tim Gardner - May 27, 2010, 4:13 p.m.
On 05/27/2010 09:05 AM, Lee Jones wrote:
> Hi Tim,
>
> Is this the kind of thing you're after?
>
> The following changes since commit f0819aaf4948e34a44d9d685615ddee74271cd70:
>    Chase Douglas (1):
>          UBUNTU: enforce CONFIG_TMPFS_POSIX_ACL=y
>
> are available in the git repository at:
>
>    git://kernel.ubuntu.com/lag/ubuntu-lucid.git lp570500
>
> Lee Jones (1):
>        UBUNTU: Enable perf to be more helpful when perf_<version>  does
> not exist.
>
>   debian/tools/perf |   19 ++++++++++++++-----
>   1 files changed, 14 insertions(+), 5 deletions(-)
>
> Kind regards,
> Lee
>
>

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.

----------------
#!/bin/bash
full_version=`uname -r`

# 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" "$@"
----------------

I find the variable naming a bit confusing. 
'version=${full_version%-$flavour}' doesn't do what it purports, though 
it does work. Perhaps some clarification?

rtg
Lee Jones - June 1, 2010, 10:44 a.m.
On 27/05/10 17:13, Tim Gardner wrote:
> On 05/27/2010 09:05 AM, Lee Jones wrote:
>> Hi Tim,
>>
>> Is this the kind of thing you're after?
>>
>> The following changes since commit
>> f0819aaf4948e34a44d9d685615ddee74271cd70:
>>    Chase Douglas (1):
>>          UBUNTU: enforce CONFIG_TMPFS_POSIX_ACL=y
>>
>> are available in the git repository at:
>>
>>    git://kernel.ubuntu.com/lag/ubuntu-lucid.git lp570500
>>
>> Lee Jones (1):
>>        UBUNTU: Enable perf to be more helpful when perf_<version>  does
>> not exist.
>>
>>   debian/tools/perf |   19 ++++++++++++++-----
>>   1 files changed, 14 insertions(+), 5 deletions(-)
>>
>> Kind regards,
>> Lee
>>
>>
>
> 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.
>
> ----------------
> #!/bin/bash
> full_version=`uname -r`
>
> # 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" "$@"
> ----------------
>
> I find the variable naming a bit confusing.
> 'version=${full_version%-$flavour}' doesn't do what it purports,
> though it does work. Perhaps some clarification?
>

That line removes the '-' and the flavour (e.g. 'server' or 'generic') from the full version, so from 2.6.32-22-server we get '2.6.32-22' in this instance.

Kind regards,
Lee

Patch

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" "$@"