diff mbox

[Resend] package: Makefile: fix perf target bug

Message ID 1d7d3b31c0da82ce8ce75778922155b7004a8f7e.1305224477.git.mfm@muteddisk.com (mailing list archive)
State New, archived
Headers show

Commit Message

matt mooney May 12, 2011, 6:25 p.m. UTC
From: matt mooney <mfm@muteddisk.com>

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 <mfm@muteddisk.com>
---
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(-)

Comments

Michal Marek May 12, 2011, 8:30 p.m. UTC | #1
On 12.5.2011 20:25, mfmooney@gmail.com 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,$@),,                                     \

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
matt mooney May 12, 2011, 9:07 p.m. UTC | #2
2011/5/12 Michal Marek <mmarek@suse.cz>:
> On 12.5.2011 20:25, mfmooney@gmail.com 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,$@),,                                     \
>
>
Michal Marek May 12, 2011, 9:20 p.m. UTC | #3
On 12.5.2011 23:07, matt mooney wrote:
> 2011/5/12 Michal Marek <mmarek@suse.cz>:
>> On 12.5.2011 20:25, mfmooney@gmail.com 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
matt mooney May 12, 2011, 9:38 p.m. UTC | #4
On Thu, May 12, 2011 at 2:20 PM, Michal Marek <mmarek@suse.cz> wrote:
> On 12.5.2011 23:07, matt mooney wrote:
>> 2011/5/12 Michal Marek <mmarek@suse.cz>:
>>> On 12.5.2011 20:25, mfmooney@gmail.com 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
Michal Marek May 13, 2011, 8:26 a.m. UTC | #5
On 12.5.2011 23:38, matt mooney wrote:
> On Thu, May 12, 2011 at 2:20 PM, Michal Marek<mmarek@suse.cz>  wrote:
>> On 12.5.2011 23:07, matt mooney wrote:
>>> 2011/5/12 Michal Marek<mmarek@suse.cz>:
>>>> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
matt mooney May 13, 2011, 6:52 p.m. UTC | #6
On Fri, May 13, 2011 at 1:26 AM, Michal Marek <mmarek@suse.cz> wrote:
> On 12.5.2011 23:38, matt mooney wrote:
>>
>> On Thu, May 12, 2011 at 2:20 PM, Michal Marek<mmarek@suse.cz>  wrote:
>>>
>>> On 12.5.2011 23:07, matt mooney wrote:
>>>>
>>>> 2011/5/12 Michal Marek<mmarek@suse.cz>:
>>>>>
>>>>> 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
Michal Marek May 13, 2011, 7:56 p.m. UTC | #7
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
matt mooney May 13, 2011, 11:26 p.m. UTC | #8
On Fri, May 13, 2011 at 12:56 PM, Michal Marek <mmarek@suse.cz> 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
diff mbox

Patch

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,$@),,                                     \