]> code.ossystems Code Review - openembedded-core.git/commitdiff
bitbake-bblayers/create: Add optional layerid argument
authorCharlie Davies <charles.davies@whitetree.xyz>
Mon, 15 Feb 2021 20:07:44 +0000 (20:07 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 6 Mar 2021 22:36:34 +0000 (22:36 +0000)
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>
meta/lib/bblayers/create.py
meta/lib/bblayers/templates/layer.conf

index f49b48d1b460994e4066b631caf63c44f4095311..7ddb777dc7299b2d1b75eab1018686cdb133ab0b 100644 (file)
@@ -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')
index e2eaff43469370a31a093681a2d61f79d866a6c5..dddfbf716e027120e182b438fd2f83f8e692726a 100644 (file)
@@ -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}"