diff mbox series

[v2] bitbake-setup: make "path" optional

Message ID 20251104155957.2345340-1-yoann.congal@smile.fr
State New
Headers show
Series [v2] bitbake-setup: make "path" optional | expand

Commit Message

Yoann Congal Nov. 4, 2025, 3:59 p.m. UTC
From: Yoann Congal <yoann.congal@smile.fr>

Layer names and path are often redundant. Allow users to omit the path
key when it is equal to the layer name by using the layer name as a
default value for its path.

For example, from poky-master.conf.json:
  "bitbake": {
    ...
    "path": "bitbake"
  },
  "openembedded-core": {
    ...
    "path": "openembedded-core"
  },
  "meta-yocto": {
    ...
    "path": "meta-yocto"
  },
  "yocto-docs": {
    ...
    "path": "yocto-docs"
  }

Remove redundant "path" keys from default-registry and tests.

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
---
Note: Now that all "path" keys are removed (because they were all redundant),
we need to ensure the "path" code path is tested by adding a test for
it.

v1->v2:
* Also make "path" optional in are_layers_changed()
---
 bin/bitbake-setup                                    |  4 ++--
 .../configurations/oe-nodistro.conf.json             |  9 +++------
 .../configurations/poky-master.conf.json             | 12 ++++--------
 lib/bb/tests/setup.py                                |  3 +--
 4 files changed, 10 insertions(+), 18 deletions(-)
diff mbox series

Patch

diff --git a/bin/bitbake-setup b/bin/bitbake-setup
index 3cd67805f..5a06394e8 100755
--- a/bin/bitbake-setup
+++ b/bin/bitbake-setup
@@ -81,7 +81,7 @@  def checkout_layers(layers, layerdir, d):
     print("Fetching layer/tool repositories into {}".format(layerdir))
     for r_name in layers:
         r_data = layers[r_name]
-        repodir = r_data["path"]
+        repodir = r_data.get("path", r_name)
         repodirs.append(repodir)
 
         r_remote = r_data['git-remote']
@@ -489,7 +489,7 @@  def are_layers_changed(layers, layerdir, d):
     changed = False
     for r_name in layers:
         r_data = layers[r_name]
-        repodir = r_data["path"]
+        repodir = r_data.get("path", r_name)
 
         r_remote = r_data['git-remote']
         rev = r_remote['rev']
diff --git a/default-registry/configurations/oe-nodistro.conf.json b/default-registry/configurations/oe-nodistro.conf.json
index 7619738b1..9cd11a218 100644
--- a/default-registry/configurations/oe-nodistro.conf.json
+++ b/default-registry/configurations/oe-nodistro.conf.json
@@ -10,8 +10,7 @@ 
                 },
                 "branch": "master",
                 "rev": "master"
-            },
-            "path": "bitbake"
+            }
         },
         "openembedded-core": {
             "git-remote": {
@@ -22,8 +21,7 @@ 
                 },
                 "branch": "master",
                 "rev": "master"
-            },
-            "path": "openembedded-core"
+            }
         },
         "yocto-docs": {
             "git-remote": {
@@ -34,8 +32,7 @@ 
                 },
                 "branch": "master",
                 "rev": "master"
-            },
-            "path": "yocto-docs"
+            }
         }
     },
     "bitbake-setup": {
diff --git a/default-registry/configurations/poky-master.conf.json b/default-registry/configurations/poky-master.conf.json
index 60531ba02..9b63ea5f0 100644
--- a/default-registry/configurations/poky-master.conf.json
+++ b/default-registry/configurations/poky-master.conf.json
@@ -10,8 +10,7 @@ 
                 },
                 "branch": "master",
                 "rev": "master"
-            },
-            "path": "bitbake"
+            }
         },
         "openembedded-core": {
             "git-remote": {
@@ -22,8 +21,7 @@ 
                 },
                 "branch": "master",
                 "rev": "master"
-            },
-            "path": "openembedded-core"
+            }
         },
         "meta-yocto": {
             "git-remote": {
@@ -34,8 +32,7 @@ 
                 },
                 "branch": "master",
                 "rev": "master"
-            },
-            "path": "meta-yocto"
+            }
         },
         "yocto-docs": {
             "git-remote": {
@@ -46,8 +43,7 @@ 
                 },
                 "branch": "master",
                 "rev": "master"
-            },
-            "path": "yocto-docs"
+            }
         }
     },
     "bitbake-setup": {
diff --git a/lib/bb/tests/setup.py b/lib/bb/tests/setup.py
index a17b8ac46..933470f78 100644
--- a/lib/bb/tests/setup.py
+++ b/lib/bb/tests/setup.py
@@ -100,8 +100,7 @@  print("BBPATH is {{}}".format(os.environ["BBPATH"]))
                 },
                 "branch": "%s",
                 "rev": "%s"
-            },
-            "path": "test-repo"
+            }
         }
     },
     "description": "Test configuration",