From 15107ba12ff35b27c2c0ae5a9dcc9c1418f55b13 Mon Sep 17 00:00:00 2001 From: Yoann Congal Date: Fri, 24 Oct 2025 02:16:18 +0200 Subject: [PATCH] meta/files: Add a jsonschema for bitbake-setup configuration files This schema is a bit loose and should validate any configuration files working with bitbake-setup but, also, some broken ones: * If present, a "bb-layer" can be an empty array. * bb-setup need at least one of "bb-layers" or "oe-template", that is not enforced in the current schema. * bb-setup accepts "configurations = []" but it results in a impossible choice in interactive mode. This is rejected by the schema. * In each configuration, "name" and "description" are optional but the flatten configuration must have them. This is not enforced by the schema. To test a configuration files against this schema: (for exemple to validate bitbake default registry) $ pip install check-jsonschema $ check-jsonschema -v --schemafile meta/files/bitbake-setup.schema.json bitbake/default-registry/configurations/* ok -- validation done The following files were checked: bitbake/default-registry/configurations/oe-nodistro.conf.json bitbake/default-registry/configurations/poky-master.conf.json Signed-off-by: Yoann Congal Signed-off-by: Mathieu Dubois-Briand --- meta/files/bitbake-setup.schema.json | 108 +++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 meta/files/bitbake-setup.schema.json diff --git a/meta/files/bitbake-setup.schema.json b/meta/files/bitbake-setup.schema.json new file mode 100644 index 0000000000..5101b0de53 --- /dev/null +++ b/meta/files/bitbake-setup.schema.json @@ -0,0 +1,108 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Schema for bitbake-setup configuration files", + "type": "object", + "required": [ + "description", + "bitbake-setup", + "version" + ], + "properties": { + "description": { + "type": "string", + "description": "Description of the bitbake-setup configuration file" + }, + "sources": { + "$ref": "layers.schema.json#/properties/sources" + }, + "bitbake-setup": { + "type": "object", + "description": "BitBake-setup configurations", + "required": [ + "configurations" + ], + "properties": { + "configurations": { + "type": "array", + "minItems": 1, + "$anchor": "configurations", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the configuration" + }, + "description": { + "type": "string", + "description": "Human-readable description of the configuration" + }, + "bb-layers": { + "type": "array", + "description": "List of BitBake layers to include", + "items": { + "type": "string" + } + }, + "oe-template": { + "type": "string", + "description": "OE-template configuration" + }, + "oe-fragments": { + "$anchor": "oe-fragments", + "type": "array", + "description": "List of BitBake configuration fragments to enable", + "items": { + "type": "string" + } + }, + "oe-fragments-one-of": { + "type": "object", + "description": "Mutually exclusive bitbake configuration fragment", + "patternProperties": { + ".*": { + "type": "object", + "required": [ + "description", + "options" + ], + "properties": { + "description": { + "type": "string", + "description": "Human-readable description of the fragment category" + }, + "options": { + "$ref": "#oe-fragments" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "configurations": { + "$ref": "#configurations" + }, + "bb-env-passthrough-additions": { + "type": "array", + "description": "List of environment variables to include in BB_ENV_PASSTHROUGH_ADDITIONS", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false + }, + "version": { + "description": "The version of this document; currently '1.0'", + "enum": [ + "1.0" + ] + } + }, + "additionalProperties": false +} -- 2.47.3