summaryrefslogtreecommitdiffstats
path: root/meta/files
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2022-08-31 13:13:57 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-09-01 10:05:42 +0100
commit72740b5dd635579e373b4bfe6ccacfe6a02aa998 (patch)
tree2e2565bd3fe0cb7fddcdd02aada61883c6d271e1 /meta/files
parentf319534dc8fc68dfe120d129154a509f0cd6a3b0 (diff)
downloadopenembedded-core-contrib-72740b5dd635579e373b4bfe6ccacfe6a02aa998.tar.gz
meta/files: add layer setup JSON schema and example
Defines a common schema for layer setup that can be consumed by tools to know how to fetch and assemble layers for end users. Also includes an example of the layer setup that constructs poky/meta-intel/imaginary product layer for reference. The schema can be used to validate a layer setup file with the commands: $ python3 -m pip install jsonschema $ jsonschema -i meta/files/layers.example.json meta/files/layers.schema.json Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Alex: I made the following modifications to Joshua's original commit: - moved the files from meta/lib to meta/files - the example json showcases a multi-repo, multi-layer setup instead of just poky - closer to a typical product - added oe-selftest that validates the example json against the schema using python3-jsonschema-native - the schema is modified so that: -- all lists (sources, layers, remotes) are replaced by objects keyed by 'name' properties of the list items. This allows using them as dicts inside Python, and makes the json more compact and readable. -- added 'contains_this_file' property to source object -- replaced 'remote' property with a 'oneOf' definition for git with a specific 'git-remote' property. 'oneOf' is problematic when schema validation fails: the diagnostic is only that none of oneOf variants matched, which is too non-specific. -- added 'describe' property to 'git-remote' object. -- removed description property for a layer source: it is not clear how to add that when auto-generating the json Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/files')
-rw-r--r--meta/files/layers.example.json72
-rw-r--r--meta/files/layers.schema.json91
2 files changed, 163 insertions, 0 deletions
diff --git a/meta/files/layers.example.json b/meta/files/layers.example.json
new file mode 100644
index 0000000000..3772404ec9
--- /dev/null
+++ b/meta/files/layers.example.json
@@ -0,0 +1,72 @@
+{
+ "sources": {
+ "meta-alex": {
+ "contains_this_file": true,
+ "git-remote": {
+ "branch": "master",
+ "describe": "",
+ "remotes": {
+ "remote-alex": {
+ "uri": "https://github.com/kanavin/meta-alex"
+ }
+ },
+ "rev": "05b25605fb8b2399e4706d7323828676bf0da0b5"
+ },
+ "layers": {
+ "meta-alex": {
+ "subpath": ""
+ }
+ },
+ "path": "meta-alex"
+ },
+ "meta-intel": {
+ "git-remote": {
+ "branch": "master",
+ "describe": "15.0-hardknott-3.3-310-g0a96edae",
+ "remotes": {
+ "origin": {
+ "uri": "git://git.yoctoproject.org/meta-intel"
+ }
+ },
+ "rev": "0a96edae609a3f48befac36af82cf1eed6786b4a"
+ },
+ "layers": {
+ "meta-intel": {
+ "subpath": ""
+ }
+ },
+ "path": "meta-intel"
+ },
+ "poky": {
+ "git-remote": {
+ "branch": "akanavin/setup-layers",
+ "describe": "4.1_M1-374-g9dda719b2a",
+ "remotes": {
+ "origin": {
+ "uri": "git://git.yoctoproject.org/poky"
+ },
+ "poky-contrib": {
+ "uri": "ssh://git@push.yoctoproject.org/poky-contrib"
+ }
+ },
+ "rev": "9dda719b2a4727a4d43a6ab8d9e23f8ca68790ec"
+ },
+ "layers": {
+ "meta": {
+ "subpath": "meta"
+ },
+ "meta-poky": {
+ "subpath": "meta-poky"
+ },
+ "meta-selftest": {
+ "subpath": "meta-selftest"
+ },
+ "meta-yocto-bsp": {
+ "subpath": "meta-yocto-bsp"
+ }
+ },
+ "path": "poky"
+ }
+ },
+ "version": "1.0"
+}
diff --git a/meta/files/layers.schema.json b/meta/files/layers.schema.json
new file mode 100644
index 0000000000..cd4ddd3dcd
--- /dev/null
+++ b/meta/files/layers.schema.json
@@ -0,0 +1,91 @@
+{
+ "description": "OpenEmbedder Layer Setup Manifest",
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "version"
+ ],
+ "properties": {
+ "version": {
+ "description": "The version of this document; currently '1.0'",
+ "enum": ["1.0"]
+ },
+ "sources": {
+ "description": "The dict of layer sources",
+ "type": "object",
+ "patternProperties": { ".*" : {
+ "type": "object",
+ "description": "The upstream source from which a set of layers may be fetched",
+ "additionalProperties": false,
+ "required": [
+ "path"
+ ],
+ "properties": {
+ "path": {
+ "description": "The path where this layer source will be placed when fetching",
+ "type": "string"
+ },
+ "contains_this_file": {
+ "description": "Whether the directory with the layer source also contains this json description. Tools may want to skip the checkout of the source then.",
+ "type": "boolean"
+ },
+ "layers": {
+ "description": "The dict of layers to be used from this upstream source",
+ "type": "object",
+ "patternProperties": { ".*" : {
+ "description": "A layer from the upstream source",
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "subpath": {
+ "description": "The subpath (relative to the source root) for this layer. Omit if the source root is the layer path",
+ "type": "string"
+ }
+ }
+ }}
+ },
+ "git-remote": {
+ "description": "A remote git source from which to fetch",
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "rev"
+ ],
+ "properties": {
+ "branch": {
+ "description": "The git branch to fetch (optional)",
+ "type": "string"
+ },
+ "rev": {
+ "description": "The git revision to checkout",
+ "type": "string"
+ },
+ "describe": {
+ "description": "The output of 'git describe' (human readable description of the revision using tags in revision history).",
+ "type": "string"
+ },
+ "remotes": {
+ "description": "The dict of git remotes to add to this repository",
+ "type": "object",
+ "patternProperties": { ".*" : {
+ "description": "A git remote",
+ "type": "object",
+ "addtionalProperties": false,
+ "required": [
+ "uri"
+ ],
+ "properties": {
+ "uri": {
+ "description": "The URI for the remote",
+ "type": "string"
+ }
+ }
+ }}
+ }
+ }
+ }
+ }
+ }
+ }}
+ }
+}