Skip to contentSkip to conversation

A new bitbake extension: .bbappend files

DISCUSSION Richard Purdie 12 participants 39 messages Jul 16, 2010 – Aug 4, 2010

lore
Share & tools
lore
#0 lore raw

Whilst our layers mechanism, is great it does have a drawback which has bugged me for a while. If you have a recipe like pointercal which has machine specific information in it and you have your new machine code in a layer, how do you add a pointercal file for your machine?

Answer is you copy the whole pointercal recipe and files into your layer, then add the single file for your machine. To me this is ugly, ugly, ugly. We hate code duplication and as soon as you create two copies of the same information, we've failed.

So how could we do this better? Somehow we need to say that a given directory X has some information which should be merged with the original recipe. I've thought through several different ways of doing this and the best solution I found was "bbappend".

The idea is that if bitbake finds any X.bbappend files, when it loads X.bb, it will also include these files after it parses the base .bb file (but before finalise and the anonymous methods run). This means that the .bbappend file can poke around and do whatever it might want to the recipe to customise it.

I went ahead and tried it out as its quite simple to code this in bitbake. I liked the result enough I've already merged this into Poky:

http://git.pokylinux.org/cgit.cgi/poky/commit/?id=63e6ba85677b8aa9f4cf9942a1fccbb8a8c72660

I'm proposing to push it to bitbake master if there are no serious objections.

As an example use case, for the pointercal case above in another later you could add a pointercal_0.0.bbappend file which contained something like:

FILESPATH := "${FILESPATH}:${@os.path.dirname(bb.data.getVar('FILE', d, True))}"

which would then cause the directory containing the bbappend file to be searched for pointercal files.

There are of course many other uses this could be put to for creating customised layers, its totally generic.

For the specific case of paths, I have wondered if there would be a way to leverage help from bitbake in creating a sane set of search paths but I'm still thinking about that. This extension is good enough in its own right in my opinion to be worthwhile.

Cheers,

Richard

#1 lore raw

I love this idea. seeing this would go a long way towards getting my employers on board with using openembedded and even getting to contribute.

#2 lore raw

I like it too.

So does this mean that PR bumps happen in the bbappend file? Obviously you need to have the recipe rebuilt if a change is made.

Carl Simonson
[email protected]

Quoted 7 lines · III

I love this idea.  seeing this would go a long way towards getting my employers on board with using openembedded and even getting to contribute.
_______________________________________________
Openembedded-devel mailing list [email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

#3 lore raw
In reply to Richard Purdie

Hi Richard,

Does this do anything different than amendrecipes.bbclass?

Mike

Quoted 5 lines · Richard Purdie

The idea is that if bitbake finds any X.bbappend files, when it loads X.bb, it will also include these files after it parses the base .bb file (but before finalise and the anonymous methods run). This means that the .bbappend file can poke around and do whatever it might want to the recipe to customise it.

#4 lore raw

It basically solves the same problem. It's slightly less flexible, in that it has to apply to a specific .bb, whereas an amend.inc can apply to any version of a recipe, etc, depending on where it resides in the FILESPATH, but amend.inc cannot be integrated into bitbake without a performance impact, because we don't necessarily know the FILESPATH until after the finalizing steps at the end of the parsing process, and then it has to re-finalize after the amend.inc is parsed, to ensure its anonymous python functions are executed. The advantage to this is its simplicity in implementation and the miniscule performance impact. One slight concern is its assumption that the basename of the filename is unique, but I expect that's okay in most real world cases.

I hope to spend some time poking at this today.

-Chris

Quoted 21 lines · Michael Smith

Hi Richard,

Does this do anything different than amendrecipes.bbclass?

Mike

Quoted 6 lines · Richard Purdie

The idea is that if bitbake finds any X.bbappend files, when it loads X.bb, it will also include these files after it parses the base .bb file (but before finalise and the anonymous methods run). This means that the .bbappend file can poke around and do whatever it might want to the recipe to customise it.

_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#5 lore raw
In reply to Michael Smith
Quoted 8 lines · Michael Smith
Quoted 5 lines · Richard Purdie

The idea is that if bitbake finds any X.bbappend files, when it loads X.bb, it will also include these files after it parses the base .bb file (but before finalise and the anonymous methods run). This means that the .bbappend file can poke around and do whatever it might want to the recipe to customise it.

Does this do anything different than amendrecipes.bbclass?

Several people have mentioned the amend bbclass. This implements something very similar in quite a different way as part of the bitbake tool itself. There are advantages and disadvantages to doing this.

The features I liked about the bbappend approach was the small amount of code change required to bitbake compared to the functionality it offers and also the overhead of the bbappend code is minimal.

I also feel the bbappend format is slightly easier for users to comprehend but that is subjective.

A downside is that the .bbappend applies to specific versions, not all versions as amend.bbclass can be setup. There are ways that could be changed.

The amend class has a greater degree of flexibility in that you can make changes to the class and it could be argued not changing the core is an advantage too.

Cheers,

Richard

#6 lore raw

2010/7/16 Richard Purdie <[email protected]>

Quoted 26 lines · Michael Smith
Quoted 3 lines
Quoted 2 lines · Richard Purdie

The idea is that if bitbake finds any X.bbappend files, when it loads X.bb, it will also include these files after it parses the base .bb

file

Quoted 5 lines
Quoted 3 lines

(but before finalise and the anonymous methods run). This means that the .bbappend file can poke around and do whatever it might want to the recipe to customise it.

Does this do anything different than amendrecipes.bbclass?

Several people have mentioned the amend bbclass. This implements something very similar in quite a different way as part of the bitbake tool itself. There are advantages and disadvantages to doing this.

The features I liked about the bbappend approach was the small amount of code change required to bitbake compared to the functionality it offers and also the overhead of the bbappend code is minimal.

I also feel the bbappend format is slightly easier for users to comprehend but that is subjective.

A downside is that the .bbappend applies to specific versions, not all versions as amend.bbclass can be setup. There are ways that could be changed.

Quoted 7 lines

The amend class has a greater degree of flexibility in that you can make changes to the class and it could be argued not changing the core is an advantage too.

Cheers,

Richard,

Looks like a fine idea to me (although I must say I was unaware of the amend class, so I cannot really compare).

An alternative I was thinking of was to have a mechanism in an overlayed recipe that would allow you to include whatever version was in a lower priority overlay, but your prososal looks also quite sound.

+1

Frans

#7 lore raw
Quoted 6 lines · Frans Meulenbroeks

Looks like a fine idea to me (although I must say I was unaware of the amend class, so I cannot really compare).

An alternative I was thinking of was to have a mechanism in an overlayed recipe that would allow you to include whatever version was in a lower priority overlay, but your prososal looks also quite sound.

I have been thinking of this approach several times also. Something like

overlay_require pointercal_0.0.bb

But I like the bbappend approach also, so

+1

from me also. Simple is good :-)

/Esben

#8 lore raw
In reply to Richard Purdie
Quoted 4 lines · Richard Purdie

For the specific case of paths, I have wondered if there would be a way to leverage help from bitbake in creating a sane set of search paths but I'm still thinking about that. This extension is good enough in its own right in my opinion to be worthwhile.

This might be true, but solving the general path problem would be much more useful.
If you want to add a new version of e.g. gcc in your ovlerlay, you have to pull over the whole gcc directory with all its .inc classes. This can't be solved by .bbapend, or am I missing something?

Regards,
Detlef

#9 lore raw
Quoted 7 lines · Detlef Vollmann
Quoted 5 lines · Richard Purdie

For the specific case of paths, I have wondered if there would be a way to leverage help from bitbake in creating a sane set of search paths but I'm still thinking about that. This extension is good enough in its own right in my opinion to be worthwhile.

Quoted 5 lines

This might be true, but solving the general path problem would be much more useful.
If you want to add a new version of e.g. gcc in your ovlerlay, you have to pull over the whole gcc directory with all its .inc classes. This can't be solved by .bbapend, or am I missing something?

You can handle that today by adding to FILESPATHBASE. All file:// files from SRC_URI are located using FILESPATH, which is constructed from FILESPATHBASE, FILESPATHPKG, and OVERRIDES.

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#10 lore raw
Quoted 16 lines · Chris Larson
Quoted 7 lines · Detlef Vollmann
Quoted 5 lines · Richard Purdie

For the specific case of paths, I have wondered if there would be a way to leverage help from bitbake in creating a sane set of search paths but I'm still thinking about that. This extension is good enough in its own right in my opinion to be worthwhile.

Quoted 5 lines

This might be true, but solving the general path problem would be much more useful.
If you want to add a new version of e.g. gcc in your ovlerlay, you have to pull over the whole gcc directory with all its .inc classes. This can't be solved by .bbapend, or am I missing something?

Quoted 3 lines

You can handle that today by adding to FILESPATHBASE. All file:// files from SRC_URI are located using FILESPATH, which is constructed from FILESPATHBASE, FILESPATHPKG, and OVERRIDES.

AFAIK this doen't work for include/require :-(

Detlef

#11 lore raw
Quoted 19 lines · Detlef Vollmann
Quoted 17 lines · Chris Larson

On Sun, Jul 18, 2010 at 3:06 AM, Detlef Vollmann <[email protected]> wrote:

Quoted 12 lines · Richard Purdie

For the specific case of paths, I have wondered if there would be a way

Quoted 5 lines

to leverage help from bitbake in creating a sane set of search paths but I'm still thinking about that. This extension is good enough in its own right in my opinion to be worthwhile.

This might be true, but solving the general path problem would be

much more useful.
If you want to add a new version of e.g. gcc in your ovlerlay, you have to pull over the whole gcc directory with all its .inc classes. This can't be solved by .bbapend, or am I missing something?

Quoted 5 lines
Quoted 4 lines

You can handle that today by adding to FILESPATHBASE. All file:// files from SRC_URI are located using FILESPATH, which is constructed from FILESPATHBASE, FILESPATHPKG, and OVERRIDES.

AFAIK this doen't work for include/require :-(

Don't copy the recipe at all, use .bbappend instead, and you won't need to have the .inc in a different collection from the recipe itself.

Alternatively, you can adjust BBPATH to also include the other collection based paths + os.path.dirname('${FILE_DIRNAME}') or so.

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#12 lore raw
Quoted 23 lines · Chris Larson
Quoted 21 lines · Detlef Vollmann
Quoted 19 lines · Chris Larson

On Sun, Jul 18, 2010 at 3:06 AM, Detlef Vollmann <[email protected]> wrote:

Quoted 11 lines · Richard Purdie

For the specific case of paths, I have wondered if there would be a way

Quoted 5 lines

to leverage help from bitbake in creating a sane set of search paths but I'm still thinking about that. This extension is good enough in its own right in my opinion to be worthwhile.

This might be true, but solving the general path problem would be

much more useful.
If you want to add a new version of e.g. gcc in your ovlerlay, you have to pull over the whole gcc directory with all its .inc classes. This can't be solved by .bbapend, or am I missing something?

You can handle that today by adding to FILESPATHBASE. All file:// files from SRC_URI are located using FILESPATH, which is constructed from FILESPATHBASE, FILESPATHPKG, and OVERRIDES.

Quoted 5 lines
Quoted 1 line

AFAIK this doen't work for include/require :-(

Don't copy the recipe at all, use .bbappend instead, and you won't need to have the .inc in a different collection from the recipe itself.

In that case I didn't understand .bbappend.
If I have a recipe gcc_4.3.2.bb in e.g. oe-stable/recipes/gcc, but in that directory is no gcc_4.4.4.bb, and I put gcc_4.4.4.bbappend into myproject/recipes/gcc, that would probably given an error like 'no .bb file to append'.
At least that's how I understood .bbappend.

Quoted 2 lines

Alternatively, you can adjust BBPATH to also include the other collection based paths + os.path.dirname('${FILE_DIRNAME}') or so.

I'd be very interested to find a way so that a 'require gcc.inc' in myproject/recipes/gcc_4.4.4.bb would find oe-stable/recipes/gcc/gcc.inc. So far I failed.

Detlef

#16 lore raw
In reply to Richard Purdie

2010/7/16 Richard Purdie <[email protected]>

Quoted 43 lines

Whilst our layers mechanism, is great it does have a drawback which has bugged me for a while. If you have a recipe like pointercal which has machine specific information in it and you have your new machine code in a layer, how do you add a pointercal file for your machine?

Answer is you copy the whole pointercal recipe and files into your layer, then add the single file for your machine. To me this is ugly, ugly, ugly. We hate code duplication and as soon as you create two copies of the same information, we've failed.

So how could we do this better? Somehow we need to say that a given directory X has some information which should be merged with the original recipe. I've thought through several different ways of doing this and the best solution I found was "bbappend".

The idea is that if bitbake finds any X.bbappend files, when it loads X.bb, it will also include these files after it parses the base .bb file (but before finalise and the anonymous methods run). This means that the .bbappend file can poke around and do whatever it might want to the recipe to customise it.

I went ahead and tried it out as its quite simple to code this in bitbake. I liked the result enough I've already merged this into Poky:

http://git.pokylinux.org/cgit.cgi/poky/commit/?id=63e6ba85677b8aa9f4cf9942a1fccbb8a8c72660

I'm proposing to push it to bitbake master if there are no serious objections.

As an example use case, for the pointercal case above in another later you could add a pointercal_0.0.bbappend file which contained something like:

FILESPATH := "${FILESPATH}:${@os.path.dirname(bb.data.getVar('FILE', d, True))}"

which would then cause the directory containing the bbappend file to be searched for pointercal files.

There are of course many other uses this could be put to for creating customised layers, its totally generic.

Quoted 9 lines

For the specific case of paths, I have wondered if there would be a way to leverage help from bitbake in creating a sane set of search paths but I'm still thinking about that. This extension is good enough in its own right in my opinion to be worthwhile.

Cheers,

Richard

I've been pondering a litlte bit more about this.
Will the .bbappend mechanism allow me to override a file in the original recipe?
If so how?

Typical use case: I want to have a dedicated defconfig for my linux kernel. Alternate use case: a dedicated busybox configuration.

Frans.

#13 lore raw
In reply to Detlef Vollmann
Quoted 36 lines · Detlef Vollmann
Quoted 23 lines · Chris Larson
Quoted 21 lines · Detlef Vollmann
Quoted 19 lines · Chris Larson

On Sun, Jul 18, 2010 at 3:06 AM, Detlef Vollmann <[email protected]> wrote:

Quoted 11 lines · Richard Purdie

For the specific case of paths, I have wondered if there would be a way

Quoted 5 lines

to leverage help from bitbake in creating a sane set of search paths but I'm still thinking about that. This extension is good enough in its own right in my opinion to be worthwhile.

This might be true, but solving the general path problem would be

much more useful.
If you want to add a new version of e.g. gcc in your ovlerlay, you have to pull over the whole gcc directory with all its .inc classes. This can't be solved by .bbapend, or am I missing something?

You can handle that today by adding to FILESPATHBASE. All file:// files from SRC_URI are located using FILESPATH, which is constructed from FILESPATHBASE, FILESPATHPKG, and OVERRIDES.

Quoted 5 lines
Quoted 1 line

AFAIK this doen't work for include/require :-(

Don't copy the recipe at all, use .bbappend instead, and you won't need to have the .inc in a different collection from the recipe itself.

In that case I didn't understand .bbappend.
If I have a recipe gcc_4.3.2.bb in e.g. oe-stable/recipes/gcc, but in that directory is no gcc_4.4.4.bb, and I put gcc_4.4.4.bbappend into myproject/recipes/gcc, that would probably given an error like 'no .bb file to append'.
At least that's how I understood .bbappend.

Quoted 5 lines
Quoted 2 lines

Alternatively, you can adjust BBPATH to also include the other collection based paths + os.path.dirname('${FILE_DIRNAME}') or so.

I'd be very interested to find a way so that a 'require gcc.inc' in myproject/recipes/gcc_4.4.4.bb would find oe-stable/recipes/gcc/gcc.inc. So far I failed.

Does something like "require recipes/gcc/gcc.inc" not just work already as it will search BBPATH...

Cheers,

Richard

#17 lore raw
In reply to Frans Meulenbroeks
Quoted 56 lines · Frans Meulenbroeks

2010/7/16 Richard Purdie <[email protected]>

Quoted 15 lines

Whilst our layers mechanism, is great it does have a drawback which has bugged me for a while. If you have a recipe like pointercal which has machine specific information in it and you have your new machine code in a layer, how do you add a pointercal file for your machine?

Answer is you copy the whole pointercal recipe and files into your layer, then add the single file for your machine. To me this is ugly, ugly, ugly. We hate code duplication and as soon as you create two copies of the same information, we've failed.

So how could we do this better? Somehow we need to say that a given directory X has some information which should be merged with the original recipe. I've thought through several different ways of doing this and the best solution I found was "bbappend".

Quoted 11 lines

The idea is that if bitbake finds any X.bbappend files, when it loads X.bb, it will also include these files after it parses the base .bb file (but before finalise and the anonymous methods run). This means that the .bbappend file can poke around and do whatever it might want to the recipe to customise it.

I went ahead and tried it out as its quite simple to code this in bitbake. I liked the result enough I've already merged this into Poky:

http://git.pokylinux.org/cgit.cgi/poky/commit/?id=63e6ba85677b8aa9f4cf9942a1fccbb8a8c72660

Quoted 17 lines

I'm proposing to push it to bitbake master if there are no serious objections.

As an example use case, for the pointercal case above in another later you could add a pointercal_0.0.bbappend file which contained something like:

FILESPATH := "${FILESPATH}:${@os.path.dirname(bb.data.getVar('FILE', d, True))}"

which would then cause the directory containing the bbappend file to be searched for pointercal files.

There are of course many other uses this could be put to for creating customised layers, its totally generic.

Quoted 9 lines

For the specific case of paths, I have wondered if there would be a way to leverage help from bitbake in creating a sane set of search paths but I'm still thinking about that. This extension is good enough in its own right in my opinion to be worthwhile.

Cheers,

Richard

Quoted 8 lines

I've been pondering a litlte bit more about this.
Will the .bbappend mechanism allow me to override a file in the original recipe?
If so how?

Typical use case: I want to have a dedicated defconfig for my linux kernel. Alternate use case: a dedicated busybox configuration.

You can do this today with FILESPATHBASE.

I.e. FILESPATHBASE =. "${TOPDIR}/files:", then mkdir -p files/busybox; cp mybusyboxdefconfig files/busybox/defconfig

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#18 lore raw

2010/7/18 Chris Larson <[email protected]>

Quoted 69 lines
Quoted 5 lines · Frans Meulenbroeks

2010/7/16 Richard Purdie <[email protected]>

Quoted 3 lines

Whilst our layers mechanism, is great it does have a drawback which has bugged me for a while. If you have a recipe like pointercal which has machine specific information in it and you have your new machine code

in

Quoted 7 lines
Quoted 7 lines

a layer, how do you add a pointercal file for your machine?

Answer is you copy the whole pointercal recipe and files into your layer, then add the single file for your machine. To me this is ugly, ugly, ugly. We hate code duplication and as soon as you create two copies of the same information, we've failed.

Quoted 7 lines
Quoted 7 lines

So how could we do this better? Somehow we need to say that a given directory X has some information which should be merged with the original recipe. I've thought through several different ways of doing this and the best solution I found was "bbappend".

The idea is that if bitbake finds any X.bbappend files, when it loads X.bb, it will also include these files after it parses the base .bb

file

Quoted 10 lines
Quoted 9 lines

(but before finalise and the anonymous methods run). This means that the .bbappend file can poke around and do whatever it might want to the recipe to customise it.

I went ahead and tried it out as its quite simple to code this in bitbake. I liked the result enough I've already merged this into Poky:

http://git.pokylinux.org/cgit.cgi/poky/commit/?id=63e6ba85677b8aa9f4cf9942a1fccbb8a8c72660

Quoted 11 lines
Quoted 11 lines

I'm proposing to push it to bitbake master if there are no serious objections.

As an example use case, for the pointercal case above in another later you could add a pointercal_0.0.bbappend file which contained something like:

FILESPATH := "${FILESPATH}:${@os.path.dirname(bb.data.getVar('FILE', d, True))}"

Quoted 8 lines
Quoted 8 lines

which would then cause the directory containing the bbappend file to be searched for pointercal files.

There are of course many other uses this could be put to for creating customised layers, its totally generic.

For the specific case of paths, I have wondered if there would be a way to leverage help from bitbake in creating a sane set of search paths

but

Quoted 8 lines
Quoted 7 lines

I'm still thinking about that. This extension is good enough in its own right in my opinion to be worthwhile.

Cheers,

Richard

Quoted 6 lines

I've been pondering a litlte bit more about this.
Will the .bbappend mechanism allow me to override a file in the original recipe?
If so how?

Typical use case: I want to have a dedicated defconfig for my linux

Quoted 9 lines

kernel.

Quoted 2 lines

Alternate use case: a dedicated busybox configuration.

You can do this today with FILESPATHBASE.

I.e. FILESPATHBASE =. "${TOPDIR}/files:", then mkdir -p files/busybox; cp mybusyboxdefconfig files/busybox/defconfig

Ah cool, didn't know that, will give it a try.
Actually this might be mentioned somewhere in the wiki (if it is not in yet). I can imagine especially wrt kernel that people want to do have their own config.

Frans

#14 lore raw
In reply to Richard Purdie
Quoted 35 lines · Richard Purdie
Quoted 34 lines · Detlef Vollmann
Quoted 18 lines · Chris Larson
Quoted 16 lines · Detlef Vollmann
Quoted 14 lines · Chris Larson

On Sun, Jul 18, 2010 at 3:06 AM, Detlef Vollmann <[email protected]> wrote:

Quoted 11 lines · Richard Purdie

For the specific case of paths, I have wondered if there would be a way

Quoted 5 lines

to leverage help from bitbake in creating a sane set of search paths but I'm still thinking about that. This extension is good enough in its own right in my opinion to be worthwhile.

This might be true, but solving the general path problem would be

much more useful.
If you want to add a new version of e.g. gcc in your ovlerlay, you have to pull over the whole gcc directory with all its .inc classes. This can't be solved by .bbapend, or am I missing something?

Quoted 8 lines
Quoted 5 lines
Quoted 4 lines

You can handle that today by adding to FILESPATHBASE. All file:// files from SRC_URI are located using FILESPATH, which is constructed from FILESPATHBASE, FILESPATHPKG, and OVERRIDES.

AFAIK this doen't work for include/require :-(

Don't copy the recipe at all, use .bbappend instead, and you won't need to have the .inc in a different collection from the recipe itself.

In that case I didn't understand .bbappend.
If I have a recipe gcc_4.3.2.bb in e.g. oe-stable/recipes/gcc, but in that directory is no gcc_4.4.4.bb, and I put gcc_4.4.4.bbappend into myproject/recipes/gcc, that would probably given an error like 'no .bb file to append'.
At least that's how I understood .bbappend.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Alternatively, you can adjust BBPATH to also include the other collection based paths + os.path.dirname('${FILE_DIRNAME}') or so.

I'd be very interested to find a way so that a 'require gcc.inc' in myproject/recipes/gcc_4.4.4.bb would find oe-stable/recipes/gcc/gcc.inc. So far I failed.

Does something like "require recipes/gcc/gcc.inc" not just work already as it will search BBPATH...

Thanks, that actually works. Great :-)

Thanks again,
Detlef

#19 lore raw
In reply to Richard Purdie
Quoted 8 lines · Richard Purdie

Whilst our layers mechanism, is great it does have a drawback which has bugged me for a while. If you have a recipe like pointercal which has machine specific information in it and you have your new machine code in a layer, how do you add a pointercal file for your machine?

Answer is you copy the whole pointercal recipe and files into your layer, then add the single file for your machine.

For our overlay distro, I solved this problem as follows (in "conf/distro/tait.conf"):

# Compute a FILESPATHBASE that will cause the FILESPATH search string (for file:// URIs) to

# list tait.openembedded directories first, and org.openembedded directories second.
# This allows us to put a single file, eg. lighttpd.conf, into our tait.openembedded distribution,
# and it will be picked up by OE in preference to the deault lighttpd.conf.
# The directory containing the recipe is not necessarily the same as the package name.
# For instance, for lighttpd_1.2.3.bb, we want
# FILE_DIRBASENAME = lighttpd
# FILESPATHBASE = "/home/roydsd/Work/DBS/tait.openembedded/branches/2.6.32/recipes/lighttpd:
# /home/roydsd/Work/DBS/org.openembedded.dev/branches/2010-02-23/recipes/lighttpd"
# BBFILES is a space-separated list of /path/to/recipes/*/*.bb patterns.
# Split each pattern at the recipes keyword to get /home/roydsd/Work/DBS/tait.oe/trunk/,
# then tack on recipes/lighttpd, and
# join the whole lot together with colons
FILE_DIRBASENAME = "${@os.path.basename(os.path.dirname(bb.data.getVar('FILE', d)))}"
FILESPATHBASE = ${@':'.join([ pattern.split('recipes')[0] + 'recipes/${FILE_DIRBASENAME}' for pattern in '${BBFILES}'.split() ])}

For example:

tait.openembedded/trunk/recipes/ntp/

└── files/
└── ntp.conf

BBFILES="/home/roydsd/Work/DBS/tait.openembedded/trunk/recipes/*/*.bb /home/roydsd/Work/DBS/org.openembedded.dev/branches/2010-02-23/recipes/*/*.bb" FILESPATHBASE="/home/roydsd/Work/DBS/tait.openembedded/trunk/recipes/ntp:/home/roydsd/Work/DBS/org.openembedded.dev/branches/2010-02-23/recipes/ntp"

Does this achieve what you had in mind?
Douglas.
=======================================================================
This email, including any attachments, is only for the intended addressee. It is subject to copyright, is confidential and may be the subject of legal or other privilege, none of which is waived or lost by reason of this transmission.
If the receiver is not the intended addressee, please accept our apologies, notify us by return, delete all copies and perform no other act on the email.
Unfortunately, we cannot warrant that the email has not been altered or corrupted during transmission.
=======================================================================

#15 lore raw
In reply to Detlef Vollmann
Quoted 2 lines

I'd be very interested to find a way so that a 'require gcc.inc' in myproject/recipes/gcc_4.4.4.bb would find

oe-stable/recipes/gcc/gcc.inc.

Quoted 1 line

So far I failed.

Try to add the relative path of the .inc to your require statement:
'require recipes/gcc/gcc.inc'
(see also the arago overlays as example) my overlays are working in this way.
The problem was, all require statements should be done in this way, so the building of overlays would be much easier.

Wolfgang

#20 lore raw
In reply to Richard Purdie
Quoted 38 lines · Richard Purdie

Whilst our layers mechanism, is great it does have a drawback which has bugged me for a while. If you have a recipe like pointercal which has machine specific information in it and you have your new machine code in a layer, how do you add a pointercal file for your machine?

Answer is you copy the whole pointercal recipe and files into your layer, then add the single file for your machine. To me this is ugly, ugly, ugly. We hate code duplication and as soon as you create two copies of the same information, we've failed.

So how could we do this better? Somehow we need to say that a given directory X has some information which should be merged with the original recipe. I've thought through several different ways of doing this and the best solution I found was "bbappend".

The idea is that if bitbake finds any X.bbappend files, when it loads X.bb, it will also include these files after it parses the base .bb file (but before finalise and the anonymous methods run). This means that the .bbappend file can poke around and do whatever it might want to the recipe to customise it.

I went ahead and tried it out as its quite simple to code this in bitbake. I liked the result enough I've already merged this into Poky:

http://git.pokylinux.org/cgit.cgi/poky/commit/?id=63e6ba85677b8aa9f4cf9942a1fccbb8a8c72660

I'm proposing to push it to bitbake master if there are no serious objections.

As an example use case, for the pointercal case above in another later you could add a pointercal_0.0.bbappend file which contained something like:

FILESPATH := "${FILESPATH}:${@os.path.dirname(bb.data.getVar('FILE', d, True))}"

which would then cause the directory containing the bbappend file to be searched for pointercal files.

Quoted 7 lines

There are of course many other uses this could be put to for creating customised layers, its totally generic.

For the specific case of paths, I have wondered if there would be a way to leverage help from bitbake in creating a sane set of search paths but I'm still thinking about that. This extension is good enough in its own right in my opinion to be worthwhile.

I must be missing something. How is this better than amend.inc where today you would just do:
# Just to make sure PR does change, could actually be omitted for this

# example
$ echo 'PR .= ".1"' > mymachine/recipes/pointercal/amend.inc
$ cp /tmp/mycal mymachine/recipes/pointercal/whatever_it_is_called

? Or did you just give too trivial of an example here, and as there are indeed places where amend.inc falls down today, this does work?

Signature · 2 lines
Tom Rini
Mentor Graphics Corporation
#21 lore raw
Quoted 54 lines · Tom Rini
Quoted 40 lines · Richard Purdie

Whilst our layers mechanism, is great it does have a drawback which has bugged me for a while. If you have a recipe like pointercal which has machine specific information in it and you have your new machine code in a layer, how do you add a pointercal file for your machine?

Answer is you copy the whole pointercal recipe and files into your layer, then add the single file for your machine. To me this is ugly, ugly, ugly. We hate code duplication and as soon as you create two copies of the same information, we've failed.

So how could we do this better? Somehow we need to say that a given directory X has some information which should be merged with the original recipe. I've thought through several different ways of doing this and the best solution I found was "bbappend".

The idea is that if bitbake finds any X.bbappend files, when it loads X.bb, it will also include these files after it parses the base .bb file (but before finalise and the anonymous methods run). This means that the .bbappend file can poke around and do whatever it might want to the recipe to customise it.

I went ahead and tried it out as its quite simple to code this in bitbake. I liked the result enough I've already merged this into Poky:

http://git.pokylinux.org/cgit.cgi/poky/commit/?id=63e6ba85677b8aa9f4cf9942a1fccbb8a8c72660

I'm proposing to push it to bitbake master if there are no serious objections.

As an example use case, for the pointercal case above in another later you could add a pointercal_0.0.bbappend file which contained something like:

FILESPATH := "${FILESPATH}:${@os.path.dirname(bb.data.getVar('FILE', d, True))}"

which would then cause the directory containing the bbappend file to be searched for pointercal files.

Quoted 8 lines

There are of course many other uses this could be put to for creating customised layers, its totally generic.

For the specific case of paths, I have wondered if there would be a way to leverage help from bitbake in creating a sane set of search paths but I'm still thinking about that. This extension is good enough in its own right in my opinion to be worthwhile.

I must be missing something. How is this better than amend.inc where today you would just do:
# Just to make sure PR does change, could actually be omitted for this

Quoted 6 lines
# example
$ echo 'PR .= ".1"' > mymachine/recipes/pointercal/amend.inc
$ cp /tmp/mycal mymachine/recipes/pointercal/whatever_it_is_called

? Or did you just give too trivial of an example here, and as there are indeed places where amend.inc falls down today, this does work?

It's the opposite. amend.inc is a bit more flexible than bbappend, not vice versa, but bbappend has fewer performance implications, and is supported directly by bitbake itself (and ensures that anonymous python functions will work fine in appended metadata). Aside: I also suspect that BBCLASSEXTEND alterations will work correctly from a bbappend, which does not work correctly today from an amend.inc.

You'd have to be careful to lock down your appended versions when using bbappend, since bitbake could easily pick a newer version without the append out from under you, which is not an issue with amend.inc. This is why I was planning to test it out with some real world situations to see if it's sufficiently flexible for most cases or not. I haven't yet had a chance.

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#22 lore raw
Quoted 73 lines · Chris Larson
Quoted 54 lines · Tom Rini
Quoted 40 lines · Richard Purdie

Whilst our layers mechanism, is great it does have a drawback which has bugged me for a while. If you have a recipe like pointercal which has machine specific information in it and you have your new machine code in a layer, how do you add a pointercal file for your machine?

Answer is you copy the whole pointercal recipe and files into your layer, then add the single file for your machine. To me this is ugly, ugly, ugly. We hate code duplication and as soon as you create two copies of the same information, we've failed.

So how could we do this better? Somehow we need to say that a given directory X has some information which should be merged with the original recipe. I've thought through several different ways of doing this and the best solution I found was "bbappend".

The idea is that if bitbake finds any X.bbappend files, when it loads X.bb, it will also include these files after it parses the base .bb file (but before finalise and the anonymous methods run). This means that the .bbappend file can poke around and do whatever it might want to the recipe to customise it.

I went ahead and tried it out as its quite simple to code this in bitbake. I liked the result enough I've already merged this into Poky:

http://git.pokylinux.org/cgit.cgi/poky/commit/?id=63e6ba85677b8aa9f4cf9942a1fccbb8a8c72660

I'm proposing to push it to bitbake master if there are no serious objections.

As an example use case, for the pointercal case above in another later you could add a pointercal_0.0.bbappend file which contained something like:

FILESPATH := "${FILESPATH}:${@os.path.dirname(bb.data.getVar('FILE', d, True))}"

which would then cause the directory containing the bbappend file to be searched for pointercal files.

Quoted 8 lines

There are of course many other uses this could be put to for creating customised layers, its totally generic.

For the specific case of paths, I have wondered if there would be a way to leverage help from bitbake in creating a sane set of search paths but I'm still thinking about that. This extension is good enough in its own right in my opinion to be worthwhile.

I must be missing something. How is this better than amend.inc where today you would just do:
# Just to make sure PR does change, could actually be omitted for this

Quoted 6 lines
# example
$ echo 'PR .= ".1"' > mymachine/recipes/pointercal/amend.inc
$ cp /tmp/mycal mymachine/recipes/pointercal/whatever_it_is_called

? Or did you just give too trivial of an example here, and as there are indeed places where amend.inc falls down today, this does work?

It's the opposite. amend.inc is a bit more flexible than bbappend, not vice versa, but bbappend has fewer performance implications, and is supported directly by bitbake itself (and ensures that anonymous python functions will work fine in appended metadata). Aside: I also suspect that BBCLASSEXTEND alterations will work correctly from a bbappend, which does not work correctly today from an amend.inc.

Quoted 4 lines

You'd have to be careful to lock down your appended versions when using bbappend, since bitbake could easily pick a newer version without the append out from under you, which is not an issue with amend.inc.

Although, I suppose you could set DEFAULT_PREFERENCE in the bbappend, so whenever you include that collection, it gets preferred.

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#23 lore raw

2010/7/19 Chris Larson <[email protected]>

Quoted 82 lines · Chris Larson
Quoted 10 lines · Tom Rini
Quoted 6 lines
Quoted 3 lines · Richard Purdie

Whilst our layers mechanism, is great it does have a drawback which has bugged me for a while. If you have a recipe like pointercal which has machine specific information in it and you have your new machine code

in

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

a layer, how do you add a pointercal file for your machine?

Answer is you copy the whole pointercal recipe and files into your layer, then add the single file for your machine. To me this is ugly, ugly, ugly. We hate code duplication and as soon as you create two copies of the same information, we've failed.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

So how could we do this better? Somehow we need to say that a given directory X has some information which should be merged with the original recipe. I've thought through several different ways of doing this and the best solution I found was "bbappend".

The idea is that if bitbake finds any X.bbappend files, when it loads X.bb, it will also include these files after it parses the base .bb

file

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

(but before finalise and the anonymous methods run). This means that the .bbappend file can poke around and do whatever it might want to the recipe to customise it.

I went ahead and tried it out as its quite simple to code this in bitbake. I liked the result enough I've already merged this into Poky:

http://git.pokylinux.org/cgit.cgi/poky/commit/?id=63e6ba85677b8aa9f4cf9942a1fccbb8a8c72660

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

I'm proposing to push it to bitbake master if there are no serious objections.

As an example use case, for the pointercal case above in another later you could add a pointercal_0.0.bbappend file which contained something like:

FILESPATH := "${FILESPATH}:${@os.path.dirname(bb.data.getVar('FILE', d, True))}"

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

which would then cause the directory containing the bbappend file to be searched for pointercal files.

There are of course many other uses this could be put to for creating customised layers, its totally generic.

For the specific case of paths, I have wondered if there would be a way to leverage help from bitbake in creating a sane set of search paths

but

Quoted 11 lines
Quoted 11 lines
Quoted 3 lines

I'm still thinking about that. This extension is good enough in its own right in my opinion to be worthwhile.

I must be missing something. How is this better than amend.inc where today you would just do:
# Just to make sure PR does change, could actually be omitted for this

# example
$ echo 'PR .= ".1"' > mymachine/recipes/pointercal/amend.inc
$ cp /tmp/mycal mymachine/recipes/pointercal/whatever_it_is_called
Quoted 8 lines
Quoted 2 lines

? Or did you just give too trivial of an example here, and as there are indeed places where amend.inc falls down today, this does work?

It's the opposite. amend.inc is a bit more flexible than bbappend, not vice versa, but bbappend has fewer performance implications, and is supported directly by bitbake itself (and ensures that anonymous python functions will work fine in appended metadata). Aside: I also suspect

that

Quoted 5 lines

BBCLASSEXTEND alterations will work correctly from a bbappend, which does not work correctly today from an amend.inc.

You'd have to be careful to lock down your appended versions when using bbappend, since bitbake could easily pick a newer version without the

Quoted 8 lines

append

Quoted 2 lines

out from under you, which is not an issue with amend.inc.

Although, I suppose you could set DEFAULT_PREFERENCE in the bbappend, so whenever you include that collection, it gets preferred.

Not if your distro decides to move to a new version. The distro choice gets

priority to DEFAULT_PREFERENCE.

Btw is there any doc on how to use amend.inc? Looks like a neat thing.

Frans

#24 lore raw
Quoted 101 lines · Frans Meulenbroeks

2010/7/19 Chris Larson <[email protected]>

Quoted 1 line

On Mon, Jul 19, 2010 at 2:22 PM, Chris Larson <[email protected]>

Quoted 8 lines · wrote:
Quoted 8 lines · Tom Rini
Quoted 4 lines
Quoted 1 line · Richard Purdie

Whilst our layers mechanism, is great it does have a drawback which

has

Quoted 10 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

bugged me for a while. If you have a recipe like pointercal which has machine specific information in it and you have your new machine code

in

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

a layer, how do you add a pointercal file for your machine?

Answer is you copy the whole pointercal recipe and files into your layer, then add the single file for your machine. To me this is ugly, ugly, ugly. We hate code duplication and as soon as you create two copies of the same information, we've failed.

Quoted 10 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

So how could we do this better? Somehow we need to say that a given directory X has some information which should be merged with the original recipe. I've thought through several different ways of doing this and the best solution I found was "bbappend".

The idea is that if bitbake finds any X.bbappend files, when it loads X.bb, it will also include these files after it parses the base .bb

file

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

(but before finalise and the anonymous methods run). This means that the .bbappend file can poke around and do whatever it might want to

the

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

recipe to customise it.

I went ahead and tried it out as its quite simple to code this in bitbake. I liked the result enough I've already merged this into

Poky:

Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

http://git.pokylinux.org/cgit.cgi/poky/commit/?id=63e6ba85677b8aa9f4cf9942a1fccbb8a8c72660

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

I'm proposing to push it to bitbake master if there are no serious objections.

As an example use case, for the pointercal case above in another

later

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

you could add a pointercal_0.0.bbappend file which contained

something

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

like:

FILESPATH := "${FILESPATH}:${@os.path.dirname(bb.data.getVar('FILE',

d,

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

True))}"

which would then cause the directory containing the bbappend file to

be

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

searched for pointercal files.

There are of course many other uses this could be put to for creating customised layers, its totally generic.

For the specific case of paths, I have wondered if there would be a

way

Quoted 3 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

to leverage help from bitbake in creating a sane set of search paths

but

Quoted 1 line
Quoted 1 line
Quoted 1 line

I'm still thinking about that. This extension is good enough in its

own

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 2 lines

right in my opinion to be worthwhile.

I must be missing something. How is this better than amend.inc where today you would just do:
# Just to make sure PR does change, could actually be omitted for this

# example
$ echo 'PR .= ".1"' > mymachine/recipes/pointercal/amend.inc
$ cp /tmp/mycal mymachine/recipes/pointercal/whatever_it_is_called

? Or did you just give too trivial of an example here, and as there

are

Quoted 9 lines
Quoted 7 lines
Quoted 1 line

indeed places where amend.inc falls down today, this does work?

It's the opposite. amend.inc is a bit more flexible than bbappend, not vice versa, but bbappend has fewer performance implications, and is supported directly by bitbake itself (and ensures that anonymous python functions will work fine in appended metadata). Aside: I also suspect

that

Quoted 1 line

BBCLASSEXTEND alterations will work correctly from a bbappend, which

does

Quoted 8 lines
Quoted 4 lines

not work correctly today from an amend.inc.

You'd have to be careful to lock down your appended versions when using bbappend, since bitbake could easily pick a newer version without the

append

Quoted 2 lines

out from under you, which is not an issue with amend.inc.

Quoted 7 lines
Quoted 4 lines

Although, I suppose you could set DEFAULT_PREFERENCE in the bbappend, so whenever you include that collection, it gets preferred.

Not if your distro decides to move to a new version. The distro choice

gets
priority to DEFAULT_PREFERENCE.

Fair point, best to use a version lockdown tool if you leverage bbappend, at this time, so there's a bit more work involved.

Btw is there any doc on how to use amend.inc? Looks like a neat thing.

I don't think so, but there isn't much to document. Just add INHERIT += "amend", and then you can place a "amend.inc" file anywhere in any recipe's FILESPATH, and it will be parsed and added onto the metadata of that recipe.
Avoid modifying BBCLASSEXTEND from it, that's known to have issues.

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#25 lore raw
Quoted 107 lines · Chris Larson
Quoted 91 lines · Frans Meulenbroeks

2010/7/19 Chris Larson <[email protected]>

Quoted 1 line

On Mon, Jul 19, 2010 at 2:22 PM, Chris Larson <[email protected]>

Quoted 6 lines · wrote:
Quoted 6 lines · Tom Rini
Quoted 4 lines
Quoted 1 line · Richard Purdie

Whilst our layers mechanism, is great it does have a drawback which

has

Quoted 10 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

bugged me for a while. If you have a recipe like pointercal which has machine specific information in it and you have your new machine code

in

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

a layer, how do you add a pointercal file for your machine?

Answer is you copy the whole pointercal recipe and files into your layer, then add the single file for your machine. To me this is ugly, ugly, ugly. We hate code duplication and as soon as you create two copies of the same information, we've failed.

Quoted 10 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

So how could we do this better? Somehow we need to say that a given directory X has some information which should be merged with the original recipe. I've thought through several different ways of doing this and the best solution I found was "bbappend".

The idea is that if bitbake finds any X.bbappend files, when it loads X.bb, it will also include these files after it parses the base .bb

file

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

(but before finalise and the anonymous methods run). This means that the .bbappend file can poke around and do whatever it might want to

the

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

recipe to customise it.

I went ahead and tried it out as its quite simple to code this in bitbake. I liked the result enough I've already merged this into

Poky:

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

http://git.pokylinux.org/cgit.cgi/poky/commit/?id=63e6ba85677b8aa9f4cf9942a1fccbb8a8c72660

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

I'm proposing to push it to bitbake master if there are no serious objections.

As an example use case, for the pointercal case above in another

later

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

you could add a pointercal_0.0.bbappend file which contained

something

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

like:

FILESPATH := "${FILESPATH}:${@os.path.dirname(bb.data.getVar('FILE',

d,

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

True))}"

which would then cause the directory containing the bbappend file to

be

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

searched for pointercal files.

There are of course many other uses this could be put to for creating customised layers, its totally generic.

For the specific case of paths, I have wondered if there would be a

way

Quoted 3 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

to leverage help from bitbake in creating a sane set of search paths

but

Quoted 1 line
Quoted 1 line
Quoted 1 line

I'm still thinking about that. This extension is good enough in its

own

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 2 lines

right in my opinion to be worthwhile.

I must be missing something. How is this better than amend.inc where today you would just do:
# Just to make sure PR does change, could actually be omitted for this

# example
$ echo 'PR .= ".1"' > mymachine/recipes/pointercal/amend.inc
$ cp /tmp/mycal mymachine/recipes/pointercal/whatever_it_is_called

? Or did you just give too trivial of an example here, and as there

are

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

indeed places where amend.inc falls down today, this does work?

It's the opposite. amend.inc is a bit more flexible than bbappend, not vice versa, but bbappend has fewer performance implications, and is supported directly by bitbake itself (and ensures that anonymous python functions will work fine in appended metadata). Aside: I also suspect

that

Quoted 1 line

BBCLASSEXTEND alterations will work correctly from a bbappend, which

does

Quoted 5 lines
Quoted 4 lines

not work correctly today from an amend.inc.

You'd have to be careful to lock down your appended versions when using bbappend, since bitbake could easily pick a newer version without the

append

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

out from under you, which is not an issue with amend.inc.

Although, I suppose you could set DEFAULT_PREFERENCE in the bbappend, so whenever you include that collection, it gets preferred.

Not if your distro decides to move to a new version. The distro choice

gets
priority to DEFAULT_PREFERENCE.

Fair point, best to use a version lockdown tool if you leverage bbappend, at this time, so there's a bit more work involved.

Quoted 7 lines

Btw is there any doc on how to use amend.inc? Looks like a neat thing.

I don't think so, but there isn't much to document. Just add INHERIT += "amend", and then you can place a "amend.inc" file anywhere in any recipe's FILESPATH, and it will be parsed and added onto the metadata of that recipe.
Avoid modifying BBCLASSEXTEND from it, that's known to have issues.

It's also needed, in some cases, to lock down your changes via OVERRIDES that will only match what you want to work on. For example, we're using a snapshot with an older python, so amend.inc in our python directory looks like:

SRC_URI_append_pn-python-native = "file://python-2.6-r73342.patch;patch=1;pnum=0" PARALLEL_MAKE_pn-python-native = ""
PR_append_pn-python-native .= ".1"

So that we only change python-native and not all of the other python recipes. This would indeed not be an issue with bbappend as we'd have put all of that into python-native_2.6.1.bbappend (but it sounds like we would have had to add something for FILESPATH manipulation? If so, that sounds really bad to me, Richard?).

Signature · 2 lines
Tom Rini
Mentor Graphics Corporation
#26 lore raw
Quoted 117 lines · Tom Rini
Quoted 108 lines · Chris Larson
Quoted 92 lines · Frans Meulenbroeks

2010/7/19 Chris Larson <[email protected]>

Quoted 1 line

On Mon, Jul 19, 2010 at 2:22 PM, Chris Larson <[email protected]>

Quoted 6 lines · wrote:
Quoted 6 lines · Tom Rini
Quoted 4 lines
Quoted 1 line · Richard Purdie

Whilst our layers mechanism, is great it does have a drawback which

has

Quoted 10 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

bugged me for a while. If you have a recipe like pointercal which has machine specific information in it and you have your new machine code

in

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

a layer, how do you add a pointercal file for your machine?

Answer is you copy the whole pointercal recipe and files into your layer, then add the single file for your machine. To me this is ugly, ugly, ugly. We hate code duplication and as soon as you create two copies of the same information, we've failed.

Quoted 10 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

So how could we do this better? Somehow we need to say that a given directory X has some information which should be merged with the original recipe. I've thought through several different ways of doing this and the best solution I found was "bbappend".

The idea is that if bitbake finds any X.bbappend files, when it loads X.bb, it will also include these files after it parses the base .bb

file

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

(but before finalise and the anonymous methods run). This means that the .bbappend file can poke around and do whatever it might want to

the

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

recipe to customise it.

I went ahead and tried it out as its quite simple to code this in bitbake. I liked the result enough I've already merged this into

Poky:

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

http://git.pokylinux.org/cgit.cgi/poky/commit/?id=63e6ba85677b8aa9f4cf9942a1fccbb8a8c72660

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

I'm proposing to push it to bitbake master if there are no serious objections.

As an example use case, for the pointercal case above in another

later

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

you could add a pointercal_0.0.bbappend file which contained

something

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

like:

FILESPATH := "${FILESPATH}:${@os.path.dirname(bb.data.getVar('FILE',

d,

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

True))}"

which would then cause the directory containing the bbappend file to

be

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

searched for pointercal files.

There are of course many other uses this could be put to for creating customised layers, its totally generic.

For the specific case of paths, I have wondered if there would be a

way

Quoted 3 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

to leverage help from bitbake in creating a sane set of search paths

but

Quoted 1 line
Quoted 1 line
Quoted 1 line

I'm still thinking about that. This extension is good enough in its

own

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 2 lines

right in my opinion to be worthwhile.

I must be missing something. How is this better than amend.inc where today you would just do:
# Just to make sure PR does change, could actually be omitted for this

# example
$ echo 'PR .= ".1"' > mymachine/recipes/pointercal/amend.inc
$ cp /tmp/mycal mymachine/recipes/pointercal/whatever_it_is_called

? Or did you just give too trivial of an example here, and as there

are

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

indeed places where amend.inc falls down today, this does work?

It's the opposite. amend.inc is a bit more flexible than bbappend, not vice versa, but bbappend has fewer performance implications, and is supported directly by bitbake itself (and ensures that anonymous python functions will work fine in appended metadata). Aside: I also suspect

that

Quoted 1 line

BBCLASSEXTEND alterations will work correctly from a bbappend, which

does

Quoted 5 lines
Quoted 4 lines

not work correctly today from an amend.inc.

You'd have to be careful to lock down your appended versions when using bbappend, since bitbake could easily pick a newer version without the

append

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

out from under you, which is not an issue with amend.inc.

Although, I suppose you could set DEFAULT_PREFERENCE in the bbappend, so whenever you include that collection, it gets preferred.

Not if your distro decides to move to a new version. The distro choice

gets
priority to DEFAULT_PREFERENCE.

Fair point, best to use a version lockdown tool if you leverage bbappend, at this time, so there's a bit more work involved.

Quoted 7 lines

Btw is there any doc on how to use amend.inc? Looks like a neat thing.

I don't think so, but there isn't much to document. Just add INHERIT += "amend", and then you can place a "amend.inc" file anywhere in any recipe's FILESPATH, and it will be parsed and added onto the metadata of that recipe.
Avoid modifying BBCLASSEXTEND from it, that's known to have issues.

Quoted 7 lines

It's also needed, in some cases, to lock down your changes via OVERRIDES that will only match what you want to work on. For example, we're using a snapshot with an older python, so amend.inc in our python directory looks like:

SRC_URI_append_pn-python-native = "file://python-2.6-r73342.patch;patch=1;pnum=0" PARALLEL_MAKE_pn-python-native = ""
PR_append_pn-python-native .= ".1"

So that we only change python-native and not all of the other python recipes. This would indeed not be an issue with bbappend as we'd have put all of that into python-native_2.6.1.bbappend (but it sounds like we would have had to add something for FILESPATH manipulation? If so, that sounds really bad to me, Richard?).

OK, misrecollection on my part. amend.inc needs you to do some form of mucking as well (if you want to add files or patches or ..) and in both cases you could stick it into local.conf.

Signature · 2 lines
Tom Rini
Mentor Graphics Corporation
#27 lore raw
In reply to Tom Rini
Quoted 7 lines · Tom Rini

It's also needed, in some cases, to lock down your changes via OVERRIDES that will only match what you want to work on. For example, we're using a snapshot with an older python, so amend.inc in our python directory looks like:

SRC_URI_append_pn-python-native = "file://python-2.6-r73342.patch;patch=1;pnum=0" PARALLEL_MAKE_pn-python-native = ""
PR_append_pn-python-native .= ".1"

So that we only change python-native and not all of the other python recipes.

I think you could get the same effect by putting your amend.inc in a python-native subdirectory under your overlay recipes/python directory.

Maybe there's some native magic going on that would break that. (I've never amended a -native package but I use the same trick for other recipes where there are multiple .bb files are in the same OE directory.)

Mike

#28 lore raw
Quoted 16 lines · Michael Smith
Quoted 5 lines · Tom Rini

It's also needed, in some cases, to lock down your changes via OVERRIDES that will only match what you want to work on. For example, we're using a snapshot with an older python, so amend.inc in our python directory looks like:

Quoted 8 lines

SRC_URI_append_pn-python-native =
"file://python-2.6-r73342.patch;patch=1;pnum=0"
PARALLEL_MAKE_pn-python-native = ""
PR_append_pn-python-native .= ".1"

So that we only change python-native and not all of the other python recipes.

Quoted 6 lines

I think you could get the same effect by putting your amend.inc in a python-native subdirectory under your overlay recipes/python directory.

Maybe there's some native magic going on that would break that. (I've never amended a -native package but I use the same trick for other recipes where there are multiple .bb files are in the same OE directory.)

Well, that works for -native or -cross, but there's no -target, so you have to use a pn- override to modify the target recipe but *not* native and cross. If you put it in python/, it applies to all of them.

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#29 lore raw

2010/7/20 Chris Larson <[email protected]>

Quoted 25 lines · Michael Smith
Quoted 5 lines
Quoted 2 lines · Tom Rini

It's also needed, in some cases, to lock down your changes via OVERRIDES that will only match what you want to work on. For example, we're using

a

Quoted 1 line
Quoted 1 line

snapshot with an older python, so amend.inc in our python directory

looks

Quoted 7 lines
Quoted 7 lines

like:

SRC_URI_append_pn-python-native =
"file://python-2.6-r73342.patch;patch=1;pnum=0"
PARALLEL_MAKE_pn-python-native = ""
PR_append_pn-python-native .= ".1"

Quoted 8 lines
Quoted 3 lines

So that we only change python-native and not all of the other python recipes.

I think you could get the same effect by putting your amend.inc in a python-native subdirectory under your overlay recipes/python directory.

Maybe there's some native magic going on that would break that. (I've

never

Quoted 9 lines
Quoted 1 line

amended a -native package but I use the same trick for other recipes

where

Quoted 1 line

there are multiple .bb files are in the same OE directory.)

Well, that works for -native or -cross, but there's no -target, so you have to use a pn- override to modify the target recipe but *not* native and cross. If you put it in python/, it applies to all of them.

Should we have/create a -native ? Seems a logical extension. (but don't know how to code it)

Frans.

Quoted 11 lines

--
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

#30 lore raw
Quoted 34 lines · Frans Meulenbroeks

2010/7/20 Chris Larson <[email protected]>

Quoted 5 lines · Michael Smith
Quoted 4 lines
Quoted 1 line · Tom Rini

It's also needed, in some cases, to lock down your changes via

OVERRIDES

Quoted 1 line
Quoted 1 line
Quoted 1 line

that will only match what you want to work on. For example, we're

using

Quoted 24 lines

a

Quoted 1 line
Quoted 1 line

snapshot with an older python, so amend.inc in our python directory

looks

Quoted 7 lines
Quoted 7 lines

like:

SRC_URI_append_pn-python-native =
"file://python-2.6-r73342.patch;patch=1;pnum=0"
PARALLEL_MAKE_pn-python-native = ""
PR_append_pn-python-native .= ".1"

Quoted 8 lines
Quoted 3 lines

So that we only change python-native and not all of the other python recipes.

I think you could get the same effect by putting your amend.inc in a python-native subdirectory under your overlay recipes/python directory.

Maybe there's some native magic going on that would break that. (I've

never

Quoted 1 line

amended a -native package but I use the same trick for other recipes

where

Quoted 1 line

there are multiple .bb files are in the same OE directory.)

Quoted 8 lines
Quoted 1 line

Well, that works for -native or -cross, but there's no -target, so you

have

Quoted 3 lines

to use a pn- override to modify the target recipe but *not* native and cross. If you put it in python/, it applies to all of them.

Should we have/create a -native ? Seems a logical extension. (but don't know how to code it)

I assume you mean -target. You could easily enough add it to FILESPATHPKG conditionally based on inherits_class() of native/cross/nativesdk/crosssdk/etc.

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#31 lore raw

Wrt the bbappend / amend.inc discussion:

I was wondering how version management would work.
I can imagine that if I change something in a bbappend file (or amend.inc) file, I would like to have something like PR that I could bump. In my case these recipes live in an overlay which is also used by co-workers. I would like to be able to trigger a rebuild when they get a modified .bbappend file.

Frans

#32 lore raw
Quoted 8 lines · Frans Meulenbroeks

Wrt the bbappend / amend.inc discussion:

I was wondering how version management would work.
I can imagine that if I change something in a bbappend file (or amend.inc) file, I would like to have something like PR that I could bump. In my case these recipes live in an overlay which is also used by co-workers. I would like to be able to trigger a rebuild when they get a modified .bbappend file.

You could use something like:

PR := "${PR}.1"

Cheers,

Richard

#34 lore raw
In reply to Richard Purdie
Quoted 21 lines · Richard Purdie

Whilst our layers mechanism, is great it does have a drawback which has bugged me for a while. If you have a recipe like pointercal which has machine specific information in it and you have your new machine code in a layer, how do you add a pointercal file for your machine?

Answer is you copy the whole pointercal recipe and files into your layer, then add the single file for your machine. To me this is ugly, ugly, ugly. We hate code duplication and as soon as you create two copies of the same information, we've failed.

So how could we do this better? Somehow we need to say that a given directory X has some information which should be merged with the original recipe. I've thought through several different ways of doing this and the best solution I found was "bbappend".

The idea is that if bitbake finds any X.bbappend files, when it loads X.bb, it will also include these files after it parses the base .bb file (but before finalise and the anonymous methods run). This means that the .bbappend file can poke around and do whatever it might want to the recipe to customise it.

Quoted 7 lines

I went ahead and tried it out as its quite simple to code this in bitbake. I liked the result enough I've already merged this into Poky:

http://git.pokylinux.org/cgit.cgi/poky/commit/?id=63e6ba85677b8aa9f4cf9942a1fccbb8a8c72660

I'm proposing to push it to bitbake master if there are no serious objections.

Whilst I think there were some initial concerns the consensus seemed to be that this was a good thing to have in bitbake, its something that has been on the feature wishlist since day one so I've merged the patch into bitbake master.

Cheers,

Richard

#35 lore raw
Quoted 28 lines · Richard Purdie
Quoted 15 lines · Richard Purdie

Whilst our layers mechanism, is great it does have a drawback which has bugged me for a while. If you have a recipe like pointercal which has machine specific information in it and you have your new machine code in a layer, how do you add a pointercal file for your machine?

Answer is you copy the whole pointercal recipe and files into your layer, then add the single file for your machine. To me this is ugly, ugly, ugly. We hate code duplication and as soon as you create two copies of the same information, we've failed.

So how could we do this better? Somehow we need to say that a given directory X has some information which should be merged with the original recipe. I've thought through several different ways of doing this and the best solution I found was "bbappend".

Quoted 10 lines

The idea is that if bitbake finds any X.bbappend files, when it loads X.bb, it will also include these files after it parses the base .bb file (but before finalise and the anonymous methods run). This means that the .bbappend file can poke around and do whatever it might want to the recipe to customise it.

I went ahead and tried it out as its quite simple to code this in bitbake. I liked the result enough I've already merged this into Poky:

http://git.pokylinux.org/cgit.cgi/poky/commit/?id=63e6ba85677b8aa9f4cf9942a1fccbb8a8c72660

Quoted 1 line
Quoted 8 lines
Quoted 2 lines

I'm proposing to push it to bitbake master if there are no serious objections.

Whilst I think there were some initial concerns the consensus seemed to be that this was a good thing to have in bitbake, its something that has been on the feature wishlist since day one so I've merged the patch into bitbake master.

Glad to hear it, nice work putting it together.

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#33 lore raw
In reply to Frans Meulenbroeks
Quoted 8 lines · Frans Meulenbroeks

Wrt the bbappend / amend.inc discussion:

I was wondering how version management would work.
I can imagine that if I change something in a bbappend file (or amend.inc) file, I would like to have something like PR that I could bump. In my case these recipes live in an overlay which is also used by co-workers. I would like to be able to trigger a rebuild when they get a modified .bbappend file.

may be use INC_PR

Quoted 6 lines

Frans
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

#36 lore raw
In reply to Richard Purdie
Quoted 27 lines · Richard Purdie
Quoted 26 lines · Richard Purdie

Whilst our layers mechanism, is great it does have a drawback which has bugged me for a while. If you have a recipe like pointercal which has machine specific information in it and you have your new machine code in a layer, how do you add a pointercal file for your machine?

Answer is you copy the whole pointercal recipe and files into your layer, then add the single file for your machine. To me this is ugly, ugly, ugly. We hate code duplication and as soon as you create two copies of the same information, we've failed.

So how could we do this better? Somehow we need to say that a given directory X has some information which should be merged with the original recipe. I've thought through several different ways of doing this and the best solution I found was "bbappend".

The idea is that if bitbake finds any X.bbappend files, when it loads X.bb, it will also include these files after it parses the base .bb file (but before finalise and the anonymous methods run). This means that the .bbappend file can poke around and do whatever it might want to the recipe to customise it.

I went ahead and tried it out as its quite simple to code this in bitbake. I liked the result enough I've already merged this into Poky:

http://git.pokylinux.org/cgit.cgi/poky/commit/?id=63e6ba85677b8aa9f4cf9942a1fccbb8a8c72660

Quoted 7 lines
Quoted 2 lines

I'm proposing to push it to bitbake master if there are no serious objections.

Whilst I think there were some initial concerns the consensus seemed to be that this was a good thing to have in bitbake, its something that has been on the feature wishlist since day one so I've merged the patch into bitbake master.

Now this fails.

$ bitbake -c clean -b virtual:native:/home/kraj/work/oe/openembedded/recipes/zlib/zlib_1.2.3.bb
Command execution failed: Traceback (most recent call last):
  File "/home/kraj/work/oe/bitbake/lib/bb/command.py", line 88, in
runAsyncCommand
    commandmethod(self.cmds_async, self, options)
  File "/home/kraj/work/oe/bitbake/lib/bb/command.py", line 174, in
buildFile
    command.cooker.buildFile(bfile, task)
  File "/home/kraj/work/oe/bitbake/lib/bb/cooker.py", line 640, in
buildFile
    the_data = self.bb_cache.loadDataFull(fn, self.get_file_appends(fn),
self.configuration.data)
  File "/home/kraj/work/oe/bitbake/lib/bb/cooker.py", line 897, in
get_file_appends
    if f in self.appendlist:
AttributeError: BBCooker instance has no attribute 'appendlist'
Quoted 9 lines

Cheers,

Richard

_______________________________________________
Bitbake-dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/bitbake-dev

#37 lore raw
Quoted 8 lines · Khem Raj
Quoted 4 lines · Richard Purdie

Whilst I think there were some initial concerns the consensus seemed to be that this was a good thing to have in bitbake, its something that has been on the feature wishlist since day one so I've merged the patch into bitbake master.

Now this fails.

Quoted 16 lines
$ bitbake -c clean -b virtual:native:/home/kraj/work/oe/openembedded/recipes/zlib/zlib_1.2.3.bb
Command execution failed: Traceback (most recent call last):
  File "/home/kraj/work/oe/bitbake/lib/bb/command.py", line 88, in
runAsyncCommand
    commandmethod(self.cmds_async, self, options)
  File "/home/kraj/work/oe/bitbake/lib/bb/command.py", line 174, in
buildFile
    command.cooker.buildFile(bfile, task)
  File "/home/kraj/work/oe/bitbake/lib/bb/cooker.py", line 640, in
buildFile
    the_data = self.bb_cache.loadDataFull(fn, self.get_file_appends(fn),
self.configuration.data)
  File "/home/kraj/work/oe/bitbake/lib/bb/cooker.py", line 897, in
get_file_appends
    if f in self.appendlist:
AttributeError: BBCooker instance has no attribute 'appendlist'

Sorry, I'd tested with partial expressions in the -b option, not full paths. I've pushed a fix.

Cheers,

Richard

#38 lore raw
Quoted 26 lines · Richard Purdie
Quoted 8 lines · Khem Raj
Quoted 4 lines · Richard Purdie

Whilst I think there were some initial concerns the consensus seemed to be that this was a good thing to have in bitbake, its something that has been on the feature wishlist since day one so I've merged the patch into bitbake master.

Now this fails.

Quoted 16 lines
$ bitbake -c clean -b virtual:native:/home/kraj/work/oe/openembedded/recipes/zlib/zlib_1.2.3.bb
Command execution failed: Traceback (most recent call last):
  File "/home/kraj/work/oe/bitbake/lib/bb/command.py", line 88, in
runAsyncCommand
    commandmethod(self.cmds_async, self, options)
  File "/home/kraj/work/oe/bitbake/lib/bb/command.py", line 174, in
buildFile
    command.cooker.buildFile(bfile, task)
  File "/home/kraj/work/oe/bitbake/lib/bb/cooker.py", line 640, in
buildFile
    the_data = self.bb_cache.loadDataFull(fn, self.get_file_appends(fn),
self.configuration.data)
  File "/home/kraj/work/oe/bitbake/lib/bb/cooker.py", line 897, in
get_file_appends
    if f in self.appendlist:
AttributeError: BBCooker instance has no attribute 'appendlist'
Quoted 2 lines

Sorry, I'd tested with partial expressions in the -b option, not full paths. I've pushed a fix.

thanks works well now :)

Quoted 6 lines

Cheers,

Richard