diff mbox series

bitbake-setup.schema.json: Add schema for "{THISDIR}" bb-layer

Message ID 20251105232333.2800541-1-yoann.congal@smile.fr
State New
Headers show
Series bitbake-setup.schema.json: Add schema for "{THISDIR}" bb-layer | expand

Commit Message

Yoann Congal Nov. 5, 2025, 11:23 p.m. UTC
From: Yoann Congal <yoann.congal@smile.fr>

A "bb-layers" element can either:
* start with "{THISDIR}/meta-xxx", then "meta-xxx" is found relative to
  the configuration file,
* or not, the layer is found where bitbake-setup has cloned
  the layer from the "sources" list (usually a layers/ directory)

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
---
 meta/files/bitbake-setup.schema.json | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

Comments

Joshua Watt Nov. 5, 2025, 11:35 p.m. UTC | #1
On Wed, Nov 5, 2025 at 4:23 PM Yoann Congal via lists.openembedded.org
<yoann.congal=smile.fr@lists.openembedded.org> wrote:
>
> From: Yoann Congal <yoann.congal@smile.fr>
>
> A "bb-layers" element can either:
> * start with "{THISDIR}/meta-xxx", then "meta-xxx" is found relative to
>   the configuration file,
> * or not, the layer is found where bitbake-setup has cloned
>   the layer from the "sources" list (usually a layers/ directory)
>
> Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
> ---
>  meta/files/bitbake-setup.schema.json | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/meta/files/bitbake-setup.schema.json b/meta/files/bitbake-setup.schema.json
> index 5101b0de53e..65d6abd16b0 100644
> --- a/meta/files/bitbake-setup.schema.json
> +++ b/meta/files/bitbake-setup.schema.json
> @@ -41,7 +41,20 @@
>                                  "type": "array",
>                                  "description": "List of BitBake layers to include",
>                                  "items": {
> -                                    "type": "string"
> +                                    "oneOf": [
> +                                        {
> +                                            "type": "string",
> +                                            "description": "Path relative to the directory containing the configuration file",
> +                                            "pattern": "^\\{THISDIR\\}/"
> +                                        },
> +                                        {
> +                                            "type": "string",
> +                                            "description": "Path relative to the directory created by bitbake-setup to store sources",
> +                                            "not": {
> +                                                "pattern": "^\\{THISDIR\\}/"
> +                                            }
> +                                        }
> +                                    ]

This seems tautological to me; can you give an example of a string
that would fail to validate?

>                                  }
>                              },
>                              "oe-template": {
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#225929): https://lists.openembedded.org/g/openembedded-core/message/225929
> Mute This Topic: https://lists.openembedded.org/mt/116144544/3616693
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [JPEWhacker@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Yoann Congal Nov. 6, 2025, 7:56 a.m. UTC | #2
Le jeu. 6 nov. 2025 à 00:35, Joshua Watt <jpewhacker@gmail.com> a écrit :

> On Wed, Nov 5, 2025 at 4:23 PM Yoann Congal via lists.openembedded.org
> <yoann.congal=smile.fr@lists.openembedded.org> wrote:
> >
> > From: Yoann Congal <yoann.congal@smile.fr>
> >
> > A "bb-layers" element can either:
> > * start with "{THISDIR}/meta-xxx", then "meta-xxx" is found relative to
> >   the configuration file,
> > * or not, the layer is found where bitbake-setup has cloned
> >   the layer from the "sources" list (usually a layers/ directory)
> >
> > Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
> > ---
> >  meta/files/bitbake-setup.schema.json | 15 ++++++++++++++-
> >  1 file changed, 14 insertions(+), 1 deletion(-)
> >
> > diff --git a/meta/files/bitbake-setup.schema.json
> b/meta/files/bitbake-setup.schema.json
> > index 5101b0de53e..65d6abd16b0 100644
> > --- a/meta/files/bitbake-setup.schema.json
> > +++ b/meta/files/bitbake-setup.schema.json
> > @@ -41,7 +41,20 @@
> >                                  "type": "array",
> >                                  "description": "List of BitBake layers
> to include",
> >                                  "items": {
> > -                                    "type": "string"
> > +                                    "oneOf": [
> > +                                        {
> > +                                            "type": "string",
> > +                                            "description": "Path
> relative to the directory containing the configuration file",
> > +                                            "pattern": "^\\{THISDIR\\}/"
> > +                                        },
> > +                                        {
> > +                                            "type": "string",
> > +                                            "description": "Path
> relative to the directory created by bitbake-setup to store sources",
> > +                                            "not": {
> > +                                                "pattern":
> "^\\{THISDIR\\}/"
> > +                                            }
> > +                                        }
> > +                                    ]
>
> This seems tautological to me; can you give an example of a string
> that would fail to validate?
>

It is tautological. As of now, every string will validate (I did not want
to limit what a path can be).
But semantically, whether they start with "{THISDIR}/" changes where the
path is looked up, so the description changes between branches.
This is coming from the bitbake-setup documentation patch review :
https://lists.openembedded.org/g/bitbake-devel/message/18267


> >                                  }
> >                              },
> >                              "oe-template": {
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#225929):
> https://lists.openembedded.org/g/openembedded-core/message/225929
> > Mute This Topic: https://lists.openembedded.org/mt/116144544/3616693
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> JPEWhacker@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
>
Alexander Kanavin Nov. 6, 2025, 8:32 a.m. UTC | #3
On Thu, 6 Nov 2025 at 08:57, Yoann Congal via lists.openembedded.org
<yoann.congal=smile.fr@lists.openembedded.org> wrote:
>> This seems tautological to me; can you give an example of a string
>> that would fail to validate?
>
>
> It is tautological. As of now, every string will validate (I did not want to limit what a path can be).
> But semantically, whether they start with "{THISDIR}/" changes where the path is looked up, so the description changes between branches.
> This is coming from the bitbake-setup documentation patch review : https://lists.openembedded.org/g/bitbake-devel/message/18267

Yep, the point is to formally document the meaning of {THISDIR} in the
schema. Maybe we should've added a separate key, e.g.
bb-layers-relative-to-config-file. Maybe we can still do that :)

Alex
diff mbox series

Patch

diff --git a/meta/files/bitbake-setup.schema.json b/meta/files/bitbake-setup.schema.json
index 5101b0de53e..65d6abd16b0 100644
--- a/meta/files/bitbake-setup.schema.json
+++ b/meta/files/bitbake-setup.schema.json
@@ -41,7 +41,20 @@ 
                                 "type": "array",
                                 "description": "List of BitBake layers to include",
                                 "items": {
-                                    "type": "string"
+                                    "oneOf": [
+                                        {
+                                            "type": "string",
+                                            "description": "Path relative to the directory containing the configuration file",
+                                            "pattern": "^\\{THISDIR\\}/"
+                                        },
+                                        {
+                                            "type": "string",
+                                            "description": "Path relative to the directory created by bitbake-setup to store sources",
+                                            "not": {
+                                                "pattern": "^\\{THISDIR\\}/"
+                                            }
+                                        }
+                                    ]
                                 }
                             },
                             "oe-template": {