diff options
| -rw-r--r-- | meta/files/layers.example.json | 72 | ||||
| -rw-r--r-- | meta/files/layers.schema.json | 91 | ||||
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/bblayers.py | 16 |
3 files changed, 178 insertions, 1 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 @@ | |||
| 1 | { | ||
| 2 | "sources": { | ||
| 3 | "meta-alex": { | ||
| 4 | "contains_this_file": true, | ||
| 5 | "git-remote": { | ||
| 6 | "branch": "master", | ||
| 7 | "describe": "", | ||
| 8 | "remotes": { | ||
| 9 | "remote-alex": { | ||
| 10 | "uri": "https://github.com/kanavin/meta-alex" | ||
| 11 | } | ||
| 12 | }, | ||
| 13 | "rev": "05b25605fb8b2399e4706d7323828676bf0da0b5" | ||
| 14 | }, | ||
| 15 | "layers": { | ||
| 16 | "meta-alex": { | ||
| 17 | "subpath": "" | ||
| 18 | } | ||
| 19 | }, | ||
| 20 | "path": "meta-alex" | ||
| 21 | }, | ||
| 22 | "meta-intel": { | ||
| 23 | "git-remote": { | ||
| 24 | "branch": "master", | ||
| 25 | "describe": "15.0-hardknott-3.3-310-g0a96edae", | ||
| 26 | "remotes": { | ||
| 27 | "origin": { | ||
| 28 | "uri": "git://git.yoctoproject.org/meta-intel" | ||
| 29 | } | ||
| 30 | }, | ||
| 31 | "rev": "0a96edae609a3f48befac36af82cf1eed6786b4a" | ||
| 32 | }, | ||
| 33 | "layers": { | ||
| 34 | "meta-intel": { | ||
| 35 | "subpath": "" | ||
| 36 | } | ||
| 37 | }, | ||
| 38 | "path": "meta-intel" | ||
| 39 | }, | ||
| 40 | "poky": { | ||
| 41 | "git-remote": { | ||
| 42 | "branch": "akanavin/setup-layers", | ||
| 43 | "describe": "4.1_M1-374-g9dda719b2a", | ||
| 44 | "remotes": { | ||
| 45 | "origin": { | ||
| 46 | "uri": "git://git.yoctoproject.org/poky" | ||
| 47 | }, | ||
| 48 | "poky-contrib": { | ||
| 49 | "uri": "ssh://git@push.yoctoproject.org/poky-contrib" | ||
| 50 | } | ||
| 51 | }, | ||
| 52 | "rev": "9dda719b2a4727a4d43a6ab8d9e23f8ca68790ec" | ||
| 53 | }, | ||
| 54 | "layers": { | ||
| 55 | "meta": { | ||
| 56 | "subpath": "meta" | ||
| 57 | }, | ||
| 58 | "meta-poky": { | ||
| 59 | "subpath": "meta-poky" | ||
| 60 | }, | ||
| 61 | "meta-selftest": { | ||
| 62 | "subpath": "meta-selftest" | ||
| 63 | }, | ||
| 64 | "meta-yocto-bsp": { | ||
| 65 | "subpath": "meta-yocto-bsp" | ||
| 66 | } | ||
| 67 | }, | ||
| 68 | "path": "poky" | ||
| 69 | } | ||
| 70 | }, | ||
| 71 | "version": "1.0" | ||
| 72 | } | ||
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 @@ | |||
| 1 | { | ||
| 2 | "description": "OpenEmbedder Layer Setup Manifest", | ||
| 3 | "type": "object", | ||
| 4 | "additionalProperties": false, | ||
| 5 | "required": [ | ||
| 6 | "version" | ||
| 7 | ], | ||
| 8 | "properties": { | ||
| 9 | "version": { | ||
| 10 | "description": "The version of this document; currently '1.0'", | ||
| 11 | "enum": ["1.0"] | ||
| 12 | }, | ||
| 13 | "sources": { | ||
| 14 | "description": "The dict of layer sources", | ||
| 15 | "type": "object", | ||
| 16 | "patternProperties": { ".*" : { | ||
| 17 | "type": "object", | ||
| 18 | "description": "The upstream source from which a set of layers may be fetched", | ||
| 19 | "additionalProperties": false, | ||
| 20 | "required": [ | ||
| 21 | "path" | ||
| 22 | ], | ||
| 23 | "properties": { | ||
| 24 | "path": { | ||
| 25 | "description": "The path where this layer source will be placed when fetching", | ||
| 26 | "type": "string" | ||
| 27 | }, | ||
| 28 | "contains_this_file": { | ||
| 29 | "description": "Whether the directory with the layer source also contains this json description. Tools may want to skip the checkout of the source then.", | ||
| 30 | "type": "boolean" | ||
| 31 | }, | ||
| 32 | "layers": { | ||
| 33 | "description": "The dict of layers to be used from this upstream source", | ||
| 34 | "type": "object", | ||
| 35 | "patternProperties": { ".*" : { | ||
| 36 | "description": "A layer from the upstream source", | ||
| 37 | "type": "object", | ||
| 38 | "additionalProperties": false, | ||
| 39 | "properties": { | ||
| 40 | "subpath": { | ||
| 41 | "description": "The subpath (relative to the source root) for this layer. Omit if the source root is the layer path", | ||
| 42 | "type": "string" | ||
| 43 | } | ||
| 44 | } | ||
| 45 | }} | ||
| 46 | }, | ||
| 47 | "git-remote": { | ||
| 48 | "description": "A remote git source from which to fetch", | ||
| 49 | "type": "object", | ||
| 50 | "additionalProperties": false, | ||
| 51 | "required": [ | ||
| 52 | "rev" | ||
| 53 | ], | ||
| 54 | "properties": { | ||
| 55 | "branch": { | ||
| 56 | "description": "The git branch to fetch (optional)", | ||
| 57 | "type": "string" | ||
| 58 | }, | ||
| 59 | "rev": { | ||
| 60 | "description": "The git revision to checkout", | ||
| 61 | "type": "string" | ||
| 62 | }, | ||
| 63 | "describe": { | ||
| 64 | "description": "The output of 'git describe' (human readable description of the revision using tags in revision history).", | ||
| 65 | "type": "string" | ||
| 66 | }, | ||
| 67 | "remotes": { | ||
| 68 | "description": "The dict of git remotes to add to this repository", | ||
| 69 | "type": "object", | ||
| 70 | "patternProperties": { ".*" : { | ||
| 71 | "description": "A git remote", | ||
| 72 | "type": "object", | ||
| 73 | "addtionalProperties": false, | ||
| 74 | "required": [ | ||
| 75 | "uri" | ||
| 76 | ], | ||
| 77 | "properties": { | ||
| 78 | "uri": { | ||
| 79 | "description": "The URI for the remote", | ||
| 80 | "type": "string" | ||
| 81 | } | ||
| 82 | } | ||
| 83 | }} | ||
| 84 | } | ||
| 85 | } | ||
| 86 | } | ||
| 87 | } | ||
| 88 | } | ||
| 89 | }} | ||
| 90 | } | ||
| 91 | } | ||
diff --git a/meta/lib/oeqa/selftest/cases/bblayers.py b/meta/lib/oeqa/selftest/cases/bblayers.py index 549abe7d10..c753a7b795 100644 --- a/meta/lib/oeqa/selftest/cases/bblayers.py +++ b/meta/lib/oeqa/selftest/cases/bblayers.py | |||
| @@ -8,12 +8,16 @@ import os | |||
| 8 | import re | 8 | import re |
| 9 | 9 | ||
| 10 | import oeqa.utils.ftools as ftools | 10 | import oeqa.utils.ftools as ftools |
| 11 | from oeqa.utils.commands import runCmd, get_bb_var, get_bb_vars | 11 | from oeqa.utils.commands import runCmd, get_bb_var, get_bb_vars, bitbake |
| 12 | 12 | ||
| 13 | from oeqa.selftest.case import OESelftestTestCase | 13 | from oeqa.selftest.case import OESelftestTestCase |
| 14 | 14 | ||
| 15 | class BitbakeLayers(OESelftestTestCase): | 15 | class BitbakeLayers(OESelftestTestCase): |
| 16 | 16 | ||
| 17 | def setUpLocal(self): | ||
| 18 | bitbake("python3-jsonschema-native") | ||
| 19 | bitbake("-c addto_recipe_sysroot python3-jsonschema-native") | ||
| 20 | |||
| 17 | def test_bitbakelayers_layerindexshowdepends(self): | 21 | def test_bitbakelayers_layerindexshowdepends(self): |
| 18 | result = runCmd('bitbake-layers layerindex-show-depends meta-poky') | 22 | result = runCmd('bitbake-layers layerindex-show-depends meta-poky') |
| 19 | find_in_contents = re.search("openembedded-core", result.output) | 23 | find_in_contents = re.search("openembedded-core", result.output) |
| @@ -128,3 +132,13 @@ class BitbakeLayers(OESelftestTestCase): | |||
| 128 | 132 | ||
| 129 | self.assertTrue(os.path.isfile(recipe_file), msg = "Can't find recipe file for %s" % recipe) | 133 | self.assertTrue(os.path.isfile(recipe_file), msg = "Can't find recipe file for %s" % recipe) |
| 130 | return os.path.basename(recipe_file) | 134 | return os.path.basename(recipe_file) |
| 135 | |||
| 136 | def validate_layersjson(self, json): | ||
| 137 | python = os.path.join(get_bb_var('STAGING_BINDIR', 'python3-jsonschema-native'), 'nativepython3') | ||
| 138 | jsonvalidator = os.path.join(get_bb_var('STAGING_BINDIR', 'python3-jsonschema-native'), 'jsonschema') | ||
| 139 | jsonschema = os.path.join(get_bb_var('COREBASE'), 'meta/files/layers.schema.json') | ||
| 140 | result = runCmd("{} {} -i {} {}".format(python, jsonvalidator, json, jsonschema)) | ||
| 141 | |||
| 142 | def test_validate_examplelayersjson(self): | ||
| 143 | json = os.path.join(get_bb_var('COREBASE'), "meta/files/layers.example.json") | ||
| 144 | self.validate_layersjson(json) | ||
