Skip to contentSkip to conversation

add basic support for b4 contribution workflow

RFC PATCH Superseded Quentin Schulz 3 participants 4 messages Jan 23, 2025 – Jan 31, 2025

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 add basic support for b4 contribution workflow

From: Quentin Schulz <[email protected]>

b4[1] is a very nice tool for mail-based contribution. A config[2] file exists to set up a few defaults. We can use it to set the Cc recipients to always add, in our case the mailing list.

This also adds a wrapper script that is called by b4 to check that each patch in the series is only for one project. Indeed, poky is actually a "collection" of multiple repositories, namely BitBake, OpenEmbedded-Core and the Yocto Docs. One patch should therefore not make changes in multiple of those projects otherwise it cannot be merged.
Additionally, a check is added to make sure that a series only touches files from one project to avoid having to figure out which patch is to be merged by which maintainer in which project repo.

Moreover, it is not uncommon to have people develop patches for those projects from within poky. This wrapper figures out which mailing lists to send patches to based on the files that are modified in the series. Considering that patches to the bitbake/doc/ directory need to be sent to both the bitbake and yocto-docs mailing list, this wrapper handles that. A limitation of the script (lsdiff actually) is that it doesn't know how to handle empty files, but those should be of rather rare occurrences.

Note that this script requires hardcoding of paths that are handled by different projects to map files to projects. Anything not mapped is assumed part of OE-Core.

[1] https://pypi.org/project/b4/
[2] https://b4.docs.kernel.org/en/latest/config.html

---
This is marked as RFC because I believe there's some additional plumbing required to make this work reliably.

Indeed, OE-Core will also get its own .b4-config,
c.f. https://lore.kernel.org/openembedded-core/[email protected]/T/#u

So the same file will exist in both OE-Core and poky, at the same location. The one from poky should always be this one (or with changes contributed via the poky mailing list) and not overridden during a merge by an update from the one in OE-Core. Not sure how to handle that yet though, does anyone know how this merging of trees is done in poky and what can be done to make this safe?

There's also a decision that was made to not allow patches to different projects in a series, but maybe that's not desired.

Finally, I'm not sure about the appropriate copyright holder for the patch and the license, I personally don't care, so up to you.

---
 .b4-config    |   3 ++
 b4-wrapper.py | 162 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 165 insertions(+)
.b4-config new file +3 -0
new file mode 100644
index 0000000000000000000000000000000000000000..26c0dd54e8b1f96bf6d1bf65520c7ec5d72edaa2
@@ -0,0 +1,3 @@
+[b4]
+  prep-perpatch-check-cmd = ./b4-wrapper.py prep-perpatch-check-cmd
+  send-auto-cc-cmd = ./b4-wrapper.py send-auto-cc-cmd
b4-wrapper.py new file +162 -0

162 lines not on this page · raw message

---
base-commit: e59da05be4365c4922e880e07a81549927cd92be
change-id: 20250117-b4-support-e4cca7ad3106

Best regards,

Signature · 1 line
Quentin Schulz <[email protected]>
#1 lore raw
Quoted 40 lines · Quentin Schulz via lists.yoctoproject.org

From: Quentin Schulz <[email protected]>

b4[1] is a very nice tool for mail-based contribution. A config[2] file exists to set up a few defaults. We can use it to set the Cc recipients to always add, in our case the mailing list.

This also adds a wrapper script that is called by b4 to check that each patch in the series is only for one project. Indeed, poky is actually a "collection" of multiple repositories, namely BitBake, OpenEmbedded-Core and the Yocto Docs. One patch should therefore not make changes in multiple of those projects otherwise it cannot be merged.
Additionally, a check is added to make sure that a series only touches files from one project to avoid having to figure out which patch is to be merged by which maintainer in which project repo.

Moreover, it is not uncommon to have people develop patches for those projects from within poky. This wrapper figures out which mailing lists to send patches to based on the files that are modified in the series. Considering that patches to the bitbake/doc/ directory need to be sent to both the bitbake and yocto-docs mailing list, this wrapper handles that. A limitation of the script (lsdiff actually) is that it doesn't know how to handle empty files, but those should be of rather rare occurrences.

Note that this script requires hardcoding of paths that are handled by different projects to map files to projects. Anything not mapped is assumed part of OE-Core.

[1] https://pypi.org/project/b4/
[2] https://b4.docs.kernel.org/en/latest/config.html

---
This is marked as RFC because I believe there's some additional plumbing required to make this work reliably.

Indeed, OE-Core will also get its own .b4-config,
c.f. https://lore.kernel.org/openembedded-core/[email protected]/T/#u

Quoted 6 lines

So the same file will exist in both OE-Core and poky, at the same location. The one from poky should always be this one (or with changes contributed via the poky mailing list) and not overridden during a merge by an update from the one in OE-Core. Not sure how to handle that yet though, does anyone know how this merging of trees is done in poky and what can be done to make this safe?

I can sort that bit. Basically we mark the config file as not being synced by combo-layer.

Quoted 5 lines

There's also a decision that was made to not allow patches to different projects in a series, but maybe that's not desired.

Finally, I'm not sure about the appropriate copyright holder for the patch and the license, I personally don't care, so up to you.

Those look fine to me.

Quoted 4 lines

---
 .b4-config    |   3 ++
 b4-wrapper.py | 162 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 2 files changed, 165 insertions(+)

I'm not against this but I would like to:

a) Put the script into OE-Core, just so that we don't have "magic" things in poky.
b) Perhaps name it something a little more poky specific
c) Move it into the scripts subdir

Cheers,

Richard

#2 lore raw

Hi Richard,

Quoted 35 lines · Richard Purdie
Quoted 34 lines · Quentin Schulz via lists.yoctoproject.org

From: Quentin Schulz <[email protected]>

b4[1] is a very nice tool for mail-based contribution. A config[2] file exists to set up a few defaults. We can use it to set the Cc recipients to always add, in our case the mailing list.

This also adds a wrapper script that is called by b4 to check that each patch in the series is only for one project. Indeed, poky is actually a "collection" of multiple repositories, namely BitBake, OpenEmbedded-Core and the Yocto Docs. One patch should therefore not make changes in multiple of those projects otherwise it cannot be merged.
Additionally, a check is added to make sure that a series only touches files from one project to avoid having to figure out which patch is to be merged by which maintainer in which project repo.

Moreover, it is not uncommon to have people develop patches for those projects from within poky. This wrapper figures out which mailing lists to send patches to based on the files that are modified in the series. Considering that patches to the bitbake/doc/ directory need to be sent to both the bitbake and yocto-docs mailing list, this wrapper handles that. A limitation of the script (lsdiff actually) is that it doesn't know how to handle empty files, but those should be of rather rare occurrences.

Note that this script requires hardcoding of paths that are handled by different projects to map files to projects. Anything not mapped is assumed part of OE-Core.

[1] https://pypi.org/project/b4/
[2] https://b4.docs.kernel.org/en/latest/config.html

---

[...]

Quoted 4 lines

I'm not against this but I would like to:

a) Put the script into OE-Core, just so that we don't have "magic" things in poky.

It is very poky-specific though. I don't have anything in mind right now but I could imagine we could need a b4 wrapper for openembedded-core at some point as well. b4-wrapper-oe-core.py and b4-wrapper-poky.py could coexistthough and be pointed at specifically by each repo's .b4-config.

Don't mind it, just find it a bit odd.

I haven't checked if b4 follows symlink, but if it can, would you want .b4-config.poky in OE-Core too and then we do the same dance as with the README.md in OE-Core/poky?

Quoted 1 line

b) Perhaps name it something a little more poky specific

b4-wrapper-poky.py? b4-wrapper-poky.py to match README.poky.md for example? My brain has already decided it's the weekend so not very creative right now :)

Cheers,
Quentin

#3 lore raw
Quoted 44 lines · Quentin Schulz

Hi Richard,

Quoted 35 lines · Richard Purdie
Quoted 34 lines · Quentin Schulz via lists.yoctoproject.org

From: Quentin Schulz <[email protected]>

b4[1] is a very nice tool for mail-based contribution. A config[2] file exists to set up a few defaults. We can use it to set the Cc recipients to always add, in our case the mailing list.

This also adds a wrapper script that is called by b4 to check that each patch in the series is only for one project. Indeed, poky is actually a "collection" of multiple repositories, namely BitBake, OpenEmbedded-Core and the Yocto Docs. One patch should therefore not make changes in multiple of those projects otherwise it cannot be merged.
Additionally, a check is added to make sure that a series only touches files from one project to avoid having to figure out which patch is to be merged by which maintainer in which project repo.

Moreover, it is not uncommon to have people develop patches for those projects from within poky. This wrapper figures out which mailing lists to send patches to based on the files that are modified in the series. Considering that patches to the bitbake/doc/ directory need to be sent to both the bitbake and yocto-docs mailing list, this wrapper handles that. A limitation of the script (lsdiff actually) is that it doesn't know how to handle empty files, but those should be of rather rare occurrences.

Note that this script requires hardcoding of paths that are handled by different projects to map files to projects. Anything not mapped is assumed part of OE-Core.

[1] https://pypi.org/project/b4/
[2] https://b4.docs.kernel.org/en/latest/config.html

---

[...]

Quoted 4 lines

I'm not against this but I would like to:

a) Put the script into OE-Core, just so that we don't have "magic" things in poky.

Quoted 6 lines

It is very poky-specific though. I don't have anything in mind right now but I could imagine we could need a b4 wrapper for openembedded-core at some point as well. b4-wrapper-oe-core.py and b4-wrapper-poky.py could coexistthough and be pointed at specifically by each repo's .b4-config.

Don't mind it, just find it a bit odd.

It is a little unusual but I'd rather this than adding poky specific content. I'm find with either a poky specific script or a parameter to put it into "poky" mode.

Quoted 3 lines

I haven't checked if b4 follows symlink, but if it can, would you want .b4-config.poky in OE-Core too and then we do the same dance as with the README.md in OE-Core/poky?

I think that would be confusing, I'm find with two different files and combo-layer can handle that easily.

Quoted 5 lines
Quoted 1 line

b) Perhaps name it something a little more poky specific

b4-wrapper-poky.py? b4-wrapper-poky.py to match README.poky.md for example? My brain has already decided it's the weekend so not very creative right now :)

Something like that. I'm also not feeling very creative atm!

Cheers,

Richard