Re: Switching between multiple DISTROs without "contamination"

Martin Weber

Hi Nicolas,

I stumbled over this issue as well. Think of it this way, the package gets built in one environment and then it's built. Now ask to build it in another environment -- but it's built already, why do It again? Yes, in theory it would contain a different set of files / services / ... but it doesn't differentiate, because it's package A in both environments, not package A and package B. So in a sense, even though your (and my) expectations differed, I believe this works as intended.

I use to solve this issue by creating an file containing the shared stuff, a recipe building for the "default" environment, and recpies for building the "XX" environment(s). Your A-XX package will be distinct from A. Now in your image setup, you can add A-XX to the XX sort of image. But keep in mind that your image is also just another recipe in the end. I believe building both in the same build dir with different distros again asks for surprises.

So, note that sharing the build dir still isn't a good idea. Richard said this is the use-case for the shared sstate so that multiple environments can share build results quickly and efficiently, and thus you wouldn't practically want a shared build dir (once you've setup sstate sharing), because you still get the benefits of not rebuilding unchanged packages, but don't step on your toes if you want to be odd one day and even another.

Best regards,

Martin Weber
Research & Development - Embedded Software Engineer

B&R Industrial Automation GmbH, B&R Stra├če 1, 5142 Eggelsberg, Austria,
Phone +43 7748 6586 - 0

-----Urspr├╝ngliche Nachricht-----
Von: yocto@... <yocto@...> Im Auftrag von Nicolas Jeker via
Gesendet: Dienstag, 12. Juli 2022 15:38
An: yocto@...
Betreff: [yocto] Switching between multiple DISTROs without "contamination"

BeSecure! This email comes from outside of ABB. Make sure you verify the sender before clicking any links or downloading/opening attachments.
If this email looks suspicious, report it by clicking 'Report Phishing' button in Outlook or raising a ticket on MyIS.

Hi all,

I'm currently using an additional layer and image to differentiate
between a release and development build (enabling NFS, SSH, root login,
etc.). To create a development build, I manually add the layer to
bblayers.conf. This works quite well, but feels a bit clumsy to
integrate into a CI/CD pipeline.

Per these past discussions here [1][2], I'm now trying to migrate to
multiple DISTROs, something like "mydistro" and "mydistro-dev".

While migrating some of the changes, I discovered that I run into
caching(?) issues. I have a recipe for an internal application and want
to include additional systemd service files in the development image.

What I did was this:

Added "application-dbg.service" to recipes-internal/application/files

Adapted recipe:

SRC_URI:append:mydistro-dev = " file://application-dbg.service"

do_install {
# ...snip...
# systemd service
install -d ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/application.service

do_install:append:mydistro-dev() {
# debug systemd services
install -d ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/application-dbg.service

When I run "DISTRO=mydistro-dev bitbake application" followed by
"DISTRO=mydistro bitbake application", the debug service file is still
present in the package. This seems to be caused by the "image"
directory in the recipe WORKDIR not being cleaned between subsequent
do_install runs. Is this expected behaviour? What's the best solution?

Kind regards,


Join { to automatically receive all group messages.