All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch.bbclass URL Reasoning
@ 2012-03-21 17:18 Robert Abel
  0 siblings, 0 replies; 5+ messages in thread
From: Robert Abel @ 2012-03-21 17:18 UTC (permalink / raw)
  To: poky

Hi,

Could somebody enlighten me why the following is done in patch.bbclass?

> def src_patches(d, all = False ):
>     workdir = d.getVar('WORKDIR', True)
>     fetch = bb.fetch2.Fetch([], d)
>     patches = []
>     sources = []
>     for url in fetch.urls:
>         local = patch_path(url, fetch, workdir)
>         if not local:
>             if all:
>                 local = fetch.localpath(url)
>                 sources.append(local)
>             continue

As you can see (or guess), patches are resolved back to their original
URLs inside the recipe folder. The ones that are copied to ${WORKDIR}
during unpack don't seem to be used at all. Is there any special reason
why this is done?

Basically, I was happily editing patches using sed when I noticed that
my changes weren't applied at all. I thought the patches are copied to
${WORKDIR} precisely for the reason that they are used, i.e. can be
edited before patching.

The reason for editing them in the first place is that they contain
specific IDs (which I put there) that a task before do_patch replaces
for actual values (e.g. MHz for external hardware) for the board
configuration so my users will be able to simply change a variable
inside their local.conf for added comfort/ease-of-use.

It seems the patches are copied just because and aren't actually
utilized at all. Could this behavior be changed to use the copied
patches instead of the original patches inside the recipe folder? IMHO
it would make much more sense to be able to edit the patches before they
are being applied without having to overwrite the original patches in
the process.

Regards

Robert


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Patch.bbclass URL Reasoning
@ 2012-03-27 12:41 Robert Abel
  2012-03-27 12:55 ` Paul Eggleton
  0 siblings, 1 reply; 5+ messages in thread
From: Robert Abel @ 2012-03-27 12:41 UTC (permalink / raw)
  To: poky

Bumpity...

So nobody is aware of this issue or has ever tried to edit a patch
before do_patch?

Regards

Robert


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Patch.bbclass URL Reasoning
  2012-03-27 12:41 Patch.bbclass URL Reasoning Robert Abel
@ 2012-03-27 12:55 ` Paul Eggleton
       [not found]   ` <4F71B96F.5020409@uni-bielefeld.de>
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Eggleton @ 2012-03-27 12:55 UTC (permalink / raw)
  To: abel; +Cc: poky

On Tuesday 27 March 2012 14:41:35 Robert Abel wrote:
> Bumpity...
> 
> So nobody is aware of this issue or has ever tried to edit a patch
> before do_patch?

I'm aware of the behaviour, I can't speak to its intention (well, the part 
where it symlinks back to the original patch I suspect intended to allow you 
to update the patch in the metadata, but I don't know why we also copy the 
patch to the WORKDIR as well). 

However if I needed to do what you want to do I would do it differently - 
instead of modifying the patches, why not just modify the file(s) in the source 
code directly? I would suggest using sed in a do_configure_prepend() to change 
the values in the source to the desired value from a variable. Depending on 
the complexity you could have the patches change the values to some easily 
replaceable string beforehand.

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Patch.bbclass URL Reasoning
       [not found]   ` <4F71B96F.5020409@uni-bielefeld.de>
@ 2012-03-27 13:05     ` Paul Eggleton
  2012-03-27 13:25       ` Bruce Ashfield
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Eggleton @ 2012-03-27 13:05 UTC (permalink / raw)
  To: abel; +Cc: poky

On Tuesday 27 March 2012 14:58:23 Robert Abel wrote:
> On 27.03.2012 14:55, Paul Eggleton wrote:
> > However if I needed to do what you want to do I would do it differently -
> > instead of modifying the patches, why not just modify the file(s) in the
> > source code directly? I would suggest using sed in a
> > do_configure_prepend() to change the values in the source to the desired
> > value from a variable. Depending on the complexity you could have the
> > patches change the values to some easily replaceable string beforehand.
> 
> That's exactly what I'm doing right now. However, since I'm patching the
> kernel and users could theoretically add patches containing my magic
> strings, I wanted to avoid a sed on git\* and instead only edit *.patch
> in ${WORKDIR}, which is why I'm asking why the copied patches go unused.

Well, I can't answer that, but I don't think it's too difficult to come up with 
a string that's unlikely to ever occur in the kernel sources.

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Patch.bbclass URL Reasoning
  2012-03-27 13:05     ` Paul Eggleton
@ 2012-03-27 13:25       ` Bruce Ashfield
  0 siblings, 0 replies; 5+ messages in thread
From: Bruce Ashfield @ 2012-03-27 13:25 UTC (permalink / raw)
  To: Paul Eggleton; +Cc: poky

On Tue, Mar 27, 2012 at 9:05 AM, Paul Eggleton
<paul.eggleton@linux.intel.com> wrote:
> On Tuesday 27 March 2012 14:58:23 Robert Abel wrote:
>> On 27.03.2012 14:55, Paul Eggleton wrote:
>> > However if I needed to do what you want to do I would do it differently -
>> > instead of modifying the patches, why not just modify the file(s) in the
>> > source code directly? I would suggest using sed in a
>> > do_configure_prepend() to change the values in the source to the desired
>> > value from a variable. Depending on the complexity you could have the
>> > patches change the values to some easily replaceable string beforehand.
>>
>> That's exactly what I'm doing right now. However, since I'm patching the
>> kernel and users could theoretically add patches containing my magic
>> strings, I wanted to avoid a sed on git\* and instead only edit *.patch
>> in ${WORKDIR}, which is why I'm asking why the copied patches go unused.
>
> Well, I can't answer that, but I don't think it's too difficult to come up with
> a string that's unlikely to ever occur in the kernel sources.

Or perhaps come up with a different model all together that avoids the need
to modify the patches on the fly :) I've had to do things very similar to this
before, and I've solved it with the include of a generated file.

That being said, I am painfully aware of the different patch locations and what
does or doesn't get used, since I had to adapt the feature processing of
linux yocto to figure out the WORKDIR variant (so there would be somewhere
writable).

That being said, the current behaviour has advantages that via the
absolute / source location of the patch, it's possible to examine the entire
directory without having to modify bitbake to recognize the files and do the
copy to WORKDIR.  Summary: the current behaviour works, and if it changed,
existing semantics would break, so if it was changed the return of WORKDIR
versus source location would be better done as an option.

Cheers,

Bruce

>
> Cheers,
> Paul
>
> --
>
> Paul Eggleton
> Intel Open Source Technology Centre
> _______________________________________________
> poky mailing list
> poky@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/poky



-- 
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-03-27 13:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-27 12:41 Patch.bbclass URL Reasoning Robert Abel
2012-03-27 12:55 ` Paul Eggleton
     [not found]   ` <4F71B96F.5020409@uni-bielefeld.de>
2012-03-27 13:05     ` Paul Eggleton
2012-03-27 13:25       ` Bruce Ashfield
  -- strict thread matches above, loose matches on Subject: below --
2012-03-21 17:18 Robert Abel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.