summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuentin Schulz <quentin.schulz@cherry.de>2025-02-05 14:58:40 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-02-06 10:40:10 +0000
commit64ef07f6c4ad1e9d836236f71032b77f7c6b5248 (patch)
treec7dace18b6793f78469c09b0313dc35b8368bf8d
parent069a3460360e5b0fda433f30d96ce18db5a7d75c (diff)
downloadpoky-64ef07f6c4ad1e9d836236f71032b77f7c6b5248.tar.gz
bitbake: b4-config: Add basic support for b4 contribution workflow
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 To recipients to always add, in our case the mailing list. This also adds a wrapper script that is called by b4 to figure out which addresses to put as Cc recipients. Considering that patches to the doc/ directory also need to be sent to the 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. Because we currently do not have anything to check for patch validity, remove requirement for b4 prep --check to be run before sending a patch series, via disable-needs-checking in prep-pre-flight-checks. [1] https://pypi.org/project/b4/ [2] https://b4.docs.kernel.org/en/latest/config.html (Bitbake rev: 8843860010c97cc10ff69205d209634639b6c5cd) Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/.b4-config4
-rwxr-xr-xbitbake/contrib/b4-wrapper-bitbake.py40
2 files changed, 44 insertions, 0 deletions
diff --git a/bitbake/.b4-config b/bitbake/.b4-config
new file mode 100644
index 0000000000..047f0b94a4
--- /dev/null
+++ b/bitbake/.b4-config
@@ -0,0 +1,4 @@
1[b4]
2 send-series-to = bitbake-devel@lists.openembedded.org
3 send-auto-cc-cmd = ./contrib/b4-wrapper-bitbake.py send-auto-cc-cmd
4 prep-pre-flight-checks = disable-needs-checking
diff --git a/bitbake/contrib/b4-wrapper-bitbake.py b/bitbake/contrib/b4-wrapper-bitbake.py
new file mode 100755
index 0000000000..87dff2c3a7
--- /dev/null
+++ b/bitbake/contrib/b4-wrapper-bitbake.py
@@ -0,0 +1,40 @@
1#!/usr/bin/env python3
2#
3# Copyright OpenEmbedded Contributors
4#
5# SPDX-License-Identifier: MIT
6#
7# This script is to be called by b4:
8# - through b4.send-auto-cc-cmd with "send-auto-cc-cmd" as first argument,
9#
10# When send-auto-cc-cmd is passed:
11#
12# This returns the list of Cc recipients for a patch.
13#
14# This script takes as stdin a patch.
15
16import subprocess
17import sys
18
19cmd = sys.argv[1]
20if cmd != "send-auto-cc-cmd":
21 sys.exit(-1)
22
23patch = sys.stdin.read()
24
25if subprocess.call(["which", "lsdiff"], stdout=subprocess.DEVNULL) != 0:
26 print("lsdiff missing from host, please install patchutils")
27 sys.exit(-1)
28
29files = subprocess.check_output(["lsdiff", "--strip-match=1", "--strip=1", "--include=doc/*"],
30 input=patch, text=True)
31if len(files):
32 print("docs@lists.yoctoproject.org")
33else:
34# Handle patches made with --no-prefix
35 files = subprocess.check_output(["lsdiff", "--include=doc/*"],
36 input=patch, text=True)
37 if len(files):
38 print("docs@lists.yoctoproject.org")
39
40sys.exit(0)