Skip to contentSkip to conversation

bitbake-setup: add descriptions for fragment choices

PATCH New Antonin Godard 1 participant 3 messages Feb 6

lore
Share & tools
lore
#0 lore raw

v5 cover bitbake-setup: add descriptions for fragment choices

---
Changes in v5:
- Rebase on master, which makes me drop PATCH 1 from v4, which was
merged.
- This is also based on https://lore.kernel.org/r/[email protected]
to avoid conflicts
- Shorten fragment descriptions
- Link to v4: https://patch.msgid.link/20260123-bitbake-setup-choose-builtin-v4-0-99361f2128f6@bootlin.com

Changes in v4:
- setup.py: move the fragments to gizmo-notemplate, add a second option
(that isn't used, but it doesn't make much sense otherwise)
- rebase on top of https://lore.kernel.org/r/[email protected]
- Link to v3: https://patch.msgid.link/20260122-bitbake-setup-choose-builtin-v3-0-c55291acc1a7@bootlin.com

Changes in v3:
- Rework logic as suggested by Alex
- Remove modifications of {oe-nodistro,poky}-whinlatter.conf.json
- Add a test case for oe-fragments-one-of
- Link to v2: https://patch.msgid.link/20260120-bitbake-setup-choose-builtin-v2-0-ade604ff2351@bootlin.com

Changes in v2:
- As suggested by Alex, change the new way of specifying fragments to
remain a dictionary so they can be extended in the future
- Link to v1: https://patch.msgid.link/20260116-bitbake-setup-choose-builtin-v1-0-8d66666a9efd@bootlin.com

---
Antonin Godard (2):
default-registry: update fragments choices with descriptions lib/bb/tests/setup.py: add tests for oe-fragments-one-of

 .../configurations/oe-nodistro-master.conf.json    |  6 ++++-
 .../configurations/poky-master.conf.json           | 16 ++++++++---
 lib/bb/tests/setup.py                              | 31 +++++++++++++++++++---
 3 files changed, 45 insertions(+), 8 deletions(-)

---
base-commit: 1ee053e1b1f9f8f008fbf7d7a5c93ebc8718d4b5
change-id: 20260116-bitbake-setup-choose-builtin-fb199054cc25

#1 lore raw

PATCH v5 1/2 default-registry: update fragments choices with descriptions

Give descriptions to the fragment choices to help the user know what to pick during 'bitbake-setup init'. These descriptions were based on the descriptions found in the corresponding configuration files in OE-Core/meta-yocto.

Also while we're at it, s/Distributions/distributions/ as "machines" is lowercase in "Target machines" above.

---
 .../configurations/oe-nodistro-master.conf.json          |  6 +++++-
 default-registry/configurations/poky-master.conf.json    | 16 +++++++++++++---
 2 files changed, 18 insertions(+), 4 deletions(-)
default-registry/configurations/oe-nodistro-master.conf.json +5 -1
index e4e842177e7..5aa148d4217 100644
@@ -33,7 +33,11 @@
             "oe-fragments-one-of": {
                 "machine": {
                     "description": "Target machines",
-                    "options" : ["machine/qemux86-64", "machine/qemuarm64", "machine/qemuriscv64"]
+                    "options" : [
+                        { "name": "machine/qemux86-64", "description": "x86-64 system on QEMU" },
+                        { "name": "machine/qemuarm64", "description": "ARMv8 system on QEMU" },
+                        { "name": "machine/qemuriscv64", "description": "RISC-V system on QEMU" }
+                    ]
                 }
             }
         }
default-registry/configurations/poky-master.conf.json +13 -3
index 0cabce95294..58d379648a3 100644
@@ -38,11 +38,21 @@
             "oe-fragments-one-of": {
                 "machine": {
                     "description": "Target machines",
-                    "options" : ["machine/qemux86-64", "machine/qemuarm64", "machine/qemuriscv64", "machine/genericarm64", "machine/genericx86-64"]
+                    "options" : [
+                        { "name": "machine/qemux86-64", "description": "x86-64 system on QEMU" },
+                        { "name": "machine/qemuarm64", "description": "ARMv8 system on QEMU" },
+                        { "name": "machine/qemuriscv64", "description": "RISC-V system on QEMU" },
+                        { "name": "machine/genericarm64", "description": "Arm64 SystemReady IR/ES platforms" },
+                        { "name": "machine/genericx86-64", "description": "x86_64 (64-bit) PCs and servers" }
+                    ]
                 },
                 "distro": {
-                    "description": "Target Distributions",
-                    "options" : ["distro/poky", "distro/poky-altcfg", "distro/poky-tiny"]
+                    "description": "Target distributions",
+                    "options" : [
+                        { "name": "distro/poky", "description": "Yocto Project Reference Distro" },
+                        { "name": "distro/poky-altcfg", "description": "Poky alternative with systemd as init manager" },
+                        { "name": "distro/poky-tiny", "description": "Poky alternative optimized for size" }
+                    ]
                 }
             },
             "configurations": [
Signature · 1 line
2.52.0
#2 lore raw

PATCH v5 2/2 lib/bb/tests/setup.py: add tests for oe-fragments-one-of

In reply to Antonin Godard

There were no tests of oe-fragments-one-of so modify gizmo-notemplate to gizmo-notemplate-fragments-one-of, and test both formats for the options (with or without a description).

In get_setup_path(), if the configuration specified on the command-line contains fragments, join everything with "-" as this is what will be the final directory name of the setup. This does not affect other current variants.

---
 lib/bb/tests/setup.py | 31 +++++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)
lib/bb/tests/setup.py +27 -4
index ef407ee9e2a..e3557d8f3b9 100644
@@ -136,10 +136,26 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
                 "oe-fragments": ["test-fragment-1"]
             },
             {
-                "name": "gizmo-notemplate",
+                "name": "gizmo-notemplate-fragments-one-of",
                 "description": "Gizmo notemplate configuration",
                 "bb-layers": ["layerC","layerD/meta-layer"],
-                "oe-fragments": ["test-fragment-2"]
+                "oe-fragments": ["test-fragment-2"],
+                "oe-fragments-one-of": {
+                    "fragment-desc": {
+                        "description": "Test fragments (with description)",
+                        "options" : [
+                            { "name": "fragment-desc-1", "description": "fragment 1 desc" },
+                            { "name": "fragment-desc-2", "description": "fragment 2 desc" }
+                        ]
+                    },
+                    "fragment-nodesc": {
+                        "description": "Test fragments (no description)",
+                        "options" : [
+                            "fragment-nodesc-1",
+                            "fragment-nodesc-2"
+                        ]
+                    }
+                }
             },
             {
                 "name": "gizmo-notemplate-with-filerelative-layers",
@@ -259,7 +275,7 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
     def get_setup_path(self, cf, c):
         if c == 'gizmo':
             return os.path.join(self.tempdir, 'bitbake-builds', 'this-is-a-custom-gizmo-build')
-        return os.path.join(self.tempdir, 'bitbake-builds', '{}-{}'.format(cf, c))
+        return os.path.join(self.tempdir, 'bitbake-builds', '{}-{}'.format(cf, "-".join(c.split())))
 
     def test_setup(self):
         # unset BBPATH to ensure tests run in isolation from the existing bitbake environment
@@ -327,7 +343,14 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
         # test-config-1 is tested as a registry config and over http, test-config-2 as a local file
         server = HTTPService(self.registrypath, host="127.0.0.1")
         server.start()
-        variants = ('gadget','gizmo','gizmo-env-passthrough','gizmo-no-fragment','gadget-notemplate','gizmo-notemplate')
+        variants = (
+            'gadget',
+            'gizmo',
+            'gizmo-env-passthrough',
+            'gizmo-no-fragment',
+            'gadget-notemplate',
+            'gizmo-notemplate-fragments-one-of fragment-desc-1 fragment-nodesc-1',
+        )
         variants_local = variants + ('gizmo-notemplate-with-filerelative-layers',)
         test_configurations = ({'name':'test-config-1','cmdline': 'test-config-1',
                                                  'buildconfigs': variants},
Signature · 1 line
2.52.0