2011-05-12 18:25:56

by matt mooney

[permalink] [raw]
Subject: [Resend PATCH] package: Makefile: fix perf target bug

From: matt mooney <[email protected]>

Specify --git-dir and --work-tree when building perf targets to
allow out-of-tree builds using O=<build-dir>.

The cat command had to be changed to allow proper file name expansion
of the files listed in MANIFEST.

Signed-off-by: matt mooney <[email protected]>
---
Hi Michal,

Sorry if you have already received this, but there seems to have been
a problem when it was first sent.

Thanks,
matt

scripts/package/Makefile | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index 1b7eaea..a32dc2d 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -118,10 +118,14 @@ perf-tar=perf-$(KERNELVERSION)

quiet_cmd_perf_tar = TAR
cmd_perf_tar = \
-git archive --prefix=$(perf-tar)/ HEAD^{tree} \
- $$(cat $(srctree)/tools/perf/MANIFEST) -o $(perf-tar).tar; \
+git --git-dir=$(srctree)/.git --work-tree=$(srctree) \
+ archive --prefix=$(perf-tar)/ HEAD^{tree} \
+ $(addprefix $(srctree)/, \
+ $(shell cat $(srctree)/tools/perf/MANIFEST)) \
+ -o $(perf-tar).tar; \
mkdir -p $(perf-tar); \
-git rev-parse HEAD > $(perf-tar)/HEAD; \
+git --git-dir=$(srctree)/.git --work-tree=$(srctree) \
+ rev-parse HEAD > $(perf-tar)/HEAD; \
tar rf $(perf-tar).tar $(perf-tar)/HEAD; \
rm -r $(perf-tar); \
$(if $(findstring tar-src,$@),, \
--
1.7.4.4


2011-05-12 20:30:40

by Michal Marek

[permalink] [raw]
Subject: Re: [Resend PATCH] package: Makefile: fix perf target bug

On 12.5.2011 20:25, [email protected] wrote:
> diff --git a/scripts/package/Makefile b/scripts/package/Makefile
> index 1b7eaea..a32dc2d 100644
> --- a/scripts/package/Makefile
> +++ b/scripts/package/Makefile
> @@ -118,10 +118,14 @@ perf-tar=perf-$(KERNELVERSION)
>
> quiet_cmd_perf_tar = TAR
> cmd_perf_tar = \
> -git archive --prefix=$(perf-tar)/ HEAD^{tree} \
> - $$(cat $(srctree)/tools/perf/MANIFEST) -o $(perf-tar).tar; \
> +git --git-dir=$(srctree)/.git --work-tree=$(srctree) \

Neither git archive not git rev-parse need the work tree, --git-dir=..
is sufficient.

Michal

> + archive --prefix=$(perf-tar)/ HEAD^{tree} \
> + $(addprefix $(srctree)/, \
> + $(shell cat $(srctree)/tools/perf/MANIFEST)) \
> + -o $(perf-tar).tar; \
> mkdir -p $(perf-tar); \
> -git rev-parse HEAD > $(perf-tar)/HEAD; \
> +git --git-dir=$(srctree)/.git --work-tree=$(srctree) \
> + rev-parse HEAD > $(perf-tar)/HEAD; \
> tar rf $(perf-tar).tar $(perf-tar)/HEAD; \
> rm -r $(perf-tar); \
> $(if $(findstring tar-src,$@),, \

2011-05-12 21:08:04

by matt mooney

[permalink] [raw]
Subject: Re: [Resend PATCH] package: Makefile: fix perf target bug

2011/5/12 Michal Marek <[email protected]>:
> On 12.5.2011 20:25, [email protected] wrote:
>> diff --git a/scripts/package/Makefile b/scripts/package/Makefile
>> index 1b7eaea..a32dc2d 100644
>> --- a/scripts/package/Makefile
>> +++ b/scripts/package/Makefile
>> @@ -118,10 +118,14 @@ perf-tar=perf-$(KERNELVERSION)
>>
>> ?quiet_cmd_perf_tar = TAR
>> ? ? ? ?cmd_perf_tar = \
>> -git archive --prefix=$(perf-tar)/ HEAD^{tree} ? ? ? ? ? ? ? ? ? ? ? \
>> - ? ? $$(cat $(srctree)/tools/perf/MANIFEST) -o $(perf-tar).tar; ?\
>> +git --git-dir=$(srctree)/.git --work-tree=$(srctree) ? ? ? ? ? ? ? ?\
>
> Neither git archive not git rev-parse need the work tree, --git-dir=..
> is sufficient.

Are you sure? --git-dir points to the .git directory and --work-tree
points to the actual source code directory. Both are needed when you
are out of the source tree and the .git directory is not really
located at .git from the $PWD.

>From an empirical standpoint, this as well as any git command that is
issued from outside of the working directory fails to function
properly without --work-tree.

-matt

>
>> + ? ? archive --prefix=$(perf-tar)/ HEAD^{tree} ? ? ? ? ? ? ? ? ? \
>> + ? ? $(addprefix $(srctree)/, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
>> + ? ? ? $(shell cat $(srctree)/tools/perf/MANIFEST)) ? ? ? ? ? ? ?\
>> + ? ? -o $(perf-tar).tar; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
>> ?mkdir -p $(perf-tar); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
>> -git rev-parse HEAD > $(perf-tar)/HEAD; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
>> +git --git-dir=$(srctree)/.git --work-tree=$(srctree) ? ? ? ? ? ? ? ?\
>> + ? ? rev-parse HEAD > $(perf-tar)/HEAD; ? ? ? ? ? ? ? ? ? ? ? ? ?\
>> ?tar rf $(perf-tar).tar $(perf-tar)/HEAD; ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
>> ?rm -r $(perf-tar); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
>> ?$(if $(findstring tar-src,$@),, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
>
>



--
GPG-Key: 9AFE00EA

2011-05-12 21:20:16

by Michal Marek

[permalink] [raw]
Subject: Re: [Resend PATCH] package: Makefile: fix perf target bug

On 12.5.2011 23:07, matt mooney wrote:
> 2011/5/12 Michal Marek <[email protected]>:
>> On 12.5.2011 20:25, [email protected] wrote:
>>> diff --git a/scripts/package/Makefile b/scripts/package/Makefile
>>> index 1b7eaea..a32dc2d 100644
>>> --- a/scripts/package/Makefile
>>> +++ b/scripts/package/Makefile
>>> @@ -118,10 +118,14 @@ perf-tar=perf-$(KERNELVERSION)
>>>
>>> quiet_cmd_perf_tar = TAR
>>> cmd_perf_tar = \
>>> -git archive --prefix=$(perf-tar)/ HEAD^{tree} \
>>> - $$(cat $(srctree)/tools/perf/MANIFEST) -o $(perf-tar).tar; \
>>> +git --git-dir=$(srctree)/.git --work-tree=$(srctree) \
>>
>> Neither git archive not git rev-parse need the work tree, --git-dir=..
>> is sufficient.
>
> Are you sure?

Yes.
$ cd /tmp
$ git --git-dir=$HOME/linux-2.6/.git rev-parse HEAD
e0a04b11e4059cab033469617c2a3ce2d8cab416

Michal

2011-05-12 21:38:21

by matt mooney

[permalink] [raw]
Subject: Re: [Resend PATCH] package: Makefile: fix perf target bug

On Thu, May 12, 2011 at 2:20 PM, Michal Marek <[email protected]> wrote:
> On 12.5.2011 23:07, matt mooney wrote:
>> 2011/5/12 Michal Marek <[email protected]>:
>>> On 12.5.2011 20:25, [email protected] wrote:
>>>> diff --git a/scripts/package/Makefile b/scripts/package/Makefile
>>>> index 1b7eaea..a32dc2d 100644
>>>> --- a/scripts/package/Makefile
>>>> +++ b/scripts/package/Makefile
>>>> @@ -118,10 +118,14 @@ perf-tar=perf-$(KERNELVERSION)
>>>>
>>>> ?quiet_cmd_perf_tar = TAR
>>>> ? ? ? ?cmd_perf_tar = \
>>>> -git archive --prefix=$(perf-tar)/ HEAD^{tree} ? ? ? ? ? ? ? ? ? ? ? \
>>>> - ? ? $$(cat $(srctree)/tools/perf/MANIFEST) -o $(perf-tar).tar; ?\
>>>> +git --git-dir=$(srctree)/.git --work-tree=$(srctree) ? ? ? ? ? ? ? ?\
>>>
>>> Neither git archive not git rev-parse need the work tree, --git-dir=..
>>> is sufficient.
>>
>> Are you sure?
>
> Yes.
> $ cd /tmp
> $ git --git-dir=$HOME/linux-2.6/.git rev-parse HEAD
> e0a04b11e4059cab033469617c2a3ce2d8cab416
>

You are right about that command, but it doesn't use the source tree.
Do a git --git-dir=$HOME/linux-2.6/.git status from /tmp and see what
happens.

So do you want me to send a new patch without --work-tree= in git rev-parse?

-matt

--
GPG-Key: 9AFE00EA

2011-05-13 00:09:17

by matt mooney

[permalink] [raw]
Subject: [PATCH v2] package: Makefile: fix perf target bug

From: matt mooney <[email protected]>

Specify --git-dir and --work-tree when building perf targets to
allow out-of-tree builds using O=<build-dir>.

The cat command had to be changed to allow proper file name expansion
of the files listed in MANIFEST.

Signed-off-by: matt mooney <[email protected]>
---
Okay, so I decided to just go ahead and send this. It removes the --work-tree
option from the git rev-parse command. I did test it the way you said, without
--work-tree on either statement, but the git archive command fails in that case.

Thanks,
matt

scripts/package/Makefile | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index 1b7eaea..2747f1f 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -118,10 +118,13 @@ perf-tar=perf-$(KERNELVERSION)

quiet_cmd_perf_tar = TAR
cmd_perf_tar = \
-git archive --prefix=$(perf-tar)/ HEAD^{tree} \
- $$(cat $(srctree)/tools/perf/MANIFEST) -o $(perf-tar).tar; \
+git --git-dir=$(srctree)/.git --work-tree=$(srctree) \
+ archive --prefix=$(perf-tar)/ HEAD^{tree} \
+ $(addprefix $(srctree)/, \
+ $(shell cat $(srctree)/tools/perf/MANIFEST)) \
+ -o $(perf-tar).tar; \
mkdir -p $(perf-tar); \
-git rev-parse HEAD > $(perf-tar)/HEAD; \
+git --git-dir=$(srctree)/.git rev-parse HEAD > $(perf-tar)/HEAD; \
tar rf $(perf-tar).tar $(perf-tar)/HEAD; \
rm -r $(perf-tar); \
$(if $(findstring tar-src,$@),, \
--
1.7.4.4

2011-05-13 08:26:51

by Michal Marek

[permalink] [raw]
Subject: Re: [Resend PATCH] package: Makefile: fix perf target bug

On 12.5.2011 23:38, matt mooney wrote:
> On Thu, May 12, 2011 at 2:20 PM, Michal Marek<[email protected]> wrote:
>> On 12.5.2011 23:07, matt mooney wrote:
>>> 2011/5/12 Michal Marek<[email protected]>:
>>>> Neither git archive not git rev-parse need the work tree, --git-dir=..
>>>> is sufficient.
>>>
>>> Are you sure?
>>
>> Yes.
>> $ cd /tmp
>> $ git --git-dir=$HOME/linux-2.6/.git rev-parse HEAD
>> e0a04b11e4059cab033469617c2a3ce2d8cab416
>>
>
> You are right about that command, but it doesn't use the source tree.

Yes, neither git rev-parse nor git archive use the work tree. That's
what I tried to explain to you in my first mail.


> Do a git --git-dir=$HOME/linux-2.6/.git status from /tmp and see what
> happens.

That's irrelevant, I only talked about archive and rev-parse.


> So do you want me to send a new patch without --work-tree= in git rev-parse?

And in git archive.

Michal

2011-05-13 18:52:42

by matt mooney

[permalink] [raw]
Subject: Re: [Resend PATCH] package: Makefile: fix perf target bug

On Fri, May 13, 2011 at 1:26 AM, Michal Marek <[email protected]> wrote:
> On 12.5.2011 23:38, matt mooney wrote:
>>
>> On Thu, May 12, 2011 at 2:20 PM, Michal Marek<[email protected]> ?wrote:
>>>
>>> On 12.5.2011 23:07, matt mooney wrote:
>>>>
>>>> 2011/5/12 Michal Marek<[email protected]>:
>>>>>
>>>>> Neither git archive not git rev-parse need the work tree, --git-dir=..
>>>>> is sufficient.
>>>>
>>>> Are you sure?
>>>
>>> Yes.
>>> $ cd /tmp
>>> $ git --git-dir=$HOME/linux-2.6/.git rev-parse HEAD
>>> e0a04b11e4059cab033469617c2a3ce2d8cab416
>>>
>>
>> You are right about that command, but it doesn't use the source tree.
>
> Yes, neither git rev-parse nor git archive use the work tree. That's what I
> tried to explain to you in my first mail.

Okay, again you are right; I erroneously thought git archive needed
the work tree too.

>> Do a git --git-dir=$HOME/linux-2.6/.git status from /tmp and see what
>> happens.
>
> That's irrelevant, I only talked about archive and rev-parse.
>
>
>> So do you want me to send a new patch without --work-tree= in git
>> rev-parse?
>
> And in git archive.

So the real problem is that tools/perf/MANIFEST contains wildcards,
and when git archive is run, file name expansion isn't working
properly. By adding the $(srctree) as a prefix, globbing works but
then git archive requires --work-tree to be set.

I really don't know of a better alternative.

Thanks,
matt

--
GPG-Key: 9AFE00EA

2011-05-13 19:56:28

by Michal Marek

[permalink] [raw]
Subject: Re: [Resend PATCH] package: Makefile: fix perf target bug

On 13.5.2011 20:52, matt mooney wrote:
> So the real problem is that tools/perf/MANIFEST contains wildcards,
> and when git archive is run, file name expansion isn't working
> properly. By adding the $(srctree) as a prefix, globbing works but
> then git archive requires --work-tree to be set.

I see. So how about
git --git-dir=$(srctree)/.git archive ... \
$$(cd $(srctree); echo $$(cat tools/perf/MANIFEST))
? That does exactly the same as before the patch, just changes to
$(srctree) so that the expansion works.

Michal

2011-05-13 23:26:28

by matt mooney

[permalink] [raw]
Subject: Re: [Resend PATCH] package: Makefile: fix perf target bug

On Fri, May 13, 2011 at 12:56 PM, Michal Marek <[email protected]> wrote:
> On 13.5.2011 20:52, matt mooney wrote:
>> So the real problem is that tools/perf/MANIFEST contains wildcards,
>> and when git archive is run, file name expansion isn't working
>> properly. By adding the $(srctree) as a prefix, globbing works but
>> then git archive requires --work-tree to be set.
>
> I see. So how about
> git --git-dir=$(srctree)/.git archive ... \
> ? ?$$(cd $(srctree); echo $$(cat tools/perf/MANIFEST))
> ? That does exactly the same as before the patch, just changes to
> $(srctree) so that the expansion works.

Sure that works too! I guess it is less invasive than my original
change. I will fix that up and resend it.

-matt

--
GPG-Key: 9AFE00EA

2011-05-13 23:41:28

by matt mooney

[permalink] [raw]
Subject: [PATCH v3] package: Makefile: fix perf target bug

From: matt mooney <[email protected]>

Specify --git-dir when building perf targets to allow out-of-tree
builds using O=<build-dir>.

The shell command in `git archive' had to be modified to allow proper
file name expansion of the files listed in MANIFEST.

Signed-off-by: matt mooney <[email protected]>
---
scripts/package/Makefile | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index 1b7eaea..03df8ee 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -118,10 +118,12 @@ perf-tar=perf-$(KERNELVERSION)

quiet_cmd_perf_tar = TAR
cmd_perf_tar = \
-git archive --prefix=$(perf-tar)/ HEAD^{tree} \
- $$(cat $(srctree)/tools/perf/MANIFEST) -o $(perf-tar).tar; \
+git --git-dir=$(srctree)/.git archive --prefix=$(perf-tar)/ \
+ HEAD^{tree} $$(cd $(srctree); \
+ echo $$(cat $(srctree)/tools/perf/MANIFEST)) \
+ -o $(perf-tar).tar; \
mkdir -p $(perf-tar); \
-git rev-parse HEAD > $(perf-tar)/HEAD; \
+git --git-dir=$(srctree)/.git rev-parse HEAD > $(perf-tar)/HEAD; \
tar rf $(perf-tar).tar $(perf-tar)/HEAD; \
rm -r $(perf-tar); \
$(if $(findstring tar-src,$@),, \
--
1.7.4.4

2011-05-15 15:40:13

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH v3] package: Makefile: fix perf target bug

Em Fri, May 13, 2011 at 04:41:12PM -0700, [email protected] escreveu:
> From: matt mooney <[email protected]>
>
> Specify --git-dir when building perf targets to allow out-of-tree
> builds using O=<build-dir>.
>
> The shell command in `git archive' had to be modified to allow proper
> file name expansion of the files listed in MANIFEST.
>
> Signed-off-by: matt mooney <[email protected]>

Michal,

Can I have your Reviewed-by or Acked-by for this one? Assuming
all is ok by now :)

- Arnaldo

2011-05-16 08:19:59

by Michal Marek

[permalink] [raw]
Subject: Re: [PATCH v3] package: Makefile: fix perf target bug

On 15.5.2011 17:40, Arnaldo Carvalho de Melo wrote:
> Em Fri, May 13, 2011 at 04:41:12PM -0700, [email protected] escreveu:
>> From: matt mooney<[email protected]>
>>
>> Specify --git-dir when building perf targets to allow out-of-tree
>> builds using O=<build-dir>.
>>
>> The shell command in `git archive' had to be modified to allow proper
>> file name expansion of the files listed in MANIFEST.
>>
>> Signed-off-by: matt mooney<[email protected]>
>
> Michal,
>
> Can I have your Reviewed-by or Acked-by for this one? Assuming
> all is ok by now :)

Reviewed-by: Michal Marek <[email protected]>

Michal

2011-06-12 18:19:38

by matt mooney

[permalink] [raw]
Subject: Re: [PATCH v3] package: Makefile: fix perf target bug

On Mon, May 16, 2011 at 1:19 AM, Michal Marek <[email protected]> wrote:
> On 15.5.2011 17:40, Arnaldo Carvalho de Melo wrote:
>>
>> Em Fri, May 13, 2011 at 04:41:12PM -0700, [email protected] escreveu:
>>>
>>> From: matt mooney<[email protected]>
>>>
>>> Specify --git-dir when building perf targets to allow out-of-tree
>>> builds using O=<build-dir>.
>>>
>>> The shell command in `git archive' had to be modified to allow proper
>>> file name expansion of the files listed in MANIFEST.
>>>
>>> Signed-off-by: matt mooney<[email protected]>
>>
>> Michal,
>>
>> ? ? ? ?Can I have your Reviewed-by or Acked-by for this one? Assuming
>> all is ok by now :)
>
> Reviewed-by: Michal Marek <[email protected]>

I do not believe this patch ever got picked up!

Thanks,
matt

--
GPG-Key: 9AFE00EA

2011-06-24 13:22:19

by Michal Marek

[permalink] [raw]
Subject: Re: [PATCH v3] package: Makefile: fix perf target bug

On 12.6.2011 20:19, matt mooney wrote:
> On Mon, May 16, 2011 at 1:19 AM, Michal Marek<[email protected]> wrote:
>> On 15.5.2011 17:40, Arnaldo Carvalho de Melo wrote:
>>>
>>> Em Fri, May 13, 2011 at 04:41:12PM -0700, [email protected] escreveu:
>>>>
>>>> From: matt mooney<[email protected]>
>>>>
>>>> Specify --git-dir when building perf targets to allow out-of-tree
>>>> builds using O=<build-dir>.
>>>>
>>>> The shell command in `git archive' had to be modified to allow proper
>>>> file name expansion of the files listed in MANIFEST.
>>>>
>>>> Signed-off-by: matt mooney<[email protected]>
>>>
>>> Michal,
>>>
>>> Can I have your Reviewed-by or Acked-by for this one? Assuming
>>> all is ok by now :)
>>
>> Reviewed-by: Michal Marek<[email protected]>
>
> I do not believe this patch ever got picked up!

I thought that Arnaldo will take it. I pushed it to
kbuild-2.6.git#packaging now.

Michal