summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharlie Davies <charles.davies@whitetree.xyz>2021-02-15 20:07:44 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-03-06 22:36:34 +0000
commit8f896bd9b34f19535838757c8f3049bae438e4fe (patch)
treeef42cf6a2ac0323019a75dbaa8cec1178589acd1
parentd10d928c6030951994bc2404cde78137c86917a4 (diff)
downloadopenembedded-core-contrib-8f896bd9b34f19535838757c8f3049bae438e4fe.tar.gz
bitbake-bblayers/create: Add optional layerid argument
This commit adds an optional layerid argument which can be passed to the bitbake-layers create-layer command. This allows for creation of a layer with a layer id different to that of the layer's name. The default behaviour of the command where the layer's id is set to the layer's name is still retained. Signed-off-by: Charlie Davies <charles.davies@whitetree.xyz> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/bblayers/create.py4
-rw-r--r--meta/lib/bblayers/templates/layer.conf10
2 files changed, 8 insertions, 6 deletions
diff --git a/meta/lib/bblayers/create.py b/meta/lib/bblayers/create.py
index f49b48d1b4..7ddb777dc7 100644
--- a/meta/lib/bblayers/create.py
+++ b/meta/lib/bblayers/create.py
@@ -35,6 +35,7 @@ class CreatePlugin(LayerPlugin):
bb.utils.mkdirhier(conf)
layername = os.path.basename(os.path.normpath(args.layerdir))
+ layerid = args.layerid if args.layerid is not None else layername
# Create the README from templates/README
readme_template = read_template('README').format(layername=layername)
@@ -54,7 +55,7 @@ class CreatePlugin(LayerPlugin):
# Create the layer.conf from templates/layer.conf
layerconf_template = read_template('layer.conf').format(
- layername=layername, priority=args.priority, compat=compat)
+ layerid=layerid, priority=args.priority, compat=compat)
layerconf = os.path.join(conf, 'layer.conf')
with open(layerconf, 'w') as fd:
fd.write(layerconf_template)
@@ -71,6 +72,7 @@ class CreatePlugin(LayerPlugin):
def register_commands(self, sp):
parser_create_layer = self.add_command(sp, 'create-layer', self.do_create_layer, parserecipes=False)
parser_create_layer.add_argument('layerdir', help='Layer directory to create')
+ parser_create_layer.add_argument('--layerid', '-i', help='Layer id to use if different from layername')
parser_create_layer.add_argument('--priority', '-p', default=6, help='Priority of recipes in layer')
parser_create_layer.add_argument('--example-recipe-name', '-e', dest='examplerecipe', default='example', help='Filename of the example recipe')
parser_create_layer.add_argument('--example-recipe-version', '-v', dest='version', default='0.1', help='Version number for the example recipe')
diff --git a/meta/lib/bblayers/templates/layer.conf b/meta/lib/bblayers/templates/layer.conf
index e2eaff4346..dddfbf716e 100644
--- a/meta/lib/bblayers/templates/layer.conf
+++ b/meta/lib/bblayers/templates/layer.conf
@@ -5,9 +5,9 @@ BBPATH .= ":${{LAYERDIR}}"
BBFILES += "${{LAYERDIR}}/recipes-*/*/*.bb \
${{LAYERDIR}}/recipes-*/*/*.bbappend"
-BBFILE_COLLECTIONS += "{layername}"
-BBFILE_PATTERN_{layername} = "^${{LAYERDIR}}/"
-BBFILE_PRIORITY_{layername} = "{priority}"
+BBFILE_COLLECTIONS += "{layerid}"
+BBFILE_PATTERN_{layerid} = "^${{LAYERDIR}}/"
+BBFILE_PRIORITY_{layerid} = "{priority}"
-LAYERDEPENDS_{layername} = "core"
-LAYERSERIES_COMPAT_{layername} = "{compat}"
+LAYERDEPENDS_{layerid} = "core"
+LAYERSERIES_COMPAT_{layerid} = "{compat}"