]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
create.py: add command arg to add layer to bblayers.conf
authorPedro Baptista <pedro.miguel.baptista@gmail.com>
Tue, 21 Feb 2023 11:49:21 +0000 (11:49 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 24 Feb 2023 13:31:41 +0000 (13:31 +0000)
Add command arg `--add-layer` which enables the create
and add layer in a single step.

Signed-off-by: Pedro Baptista <pedro.miguel.baptista@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/bblayers/create.py

index c8f3f1b370ef8c98a9e4f2178c67690332ad70f8..517554c587d76989169c67ec1a2e8bd0713f8b1e 100644 (file)
@@ -12,6 +12,7 @@ import shutil
 import bb.utils
 
 from bblayers.common import LayerPlugin
+from bblayers.action import ActionPlugin
 
 logger = logging.getLogger('bitbake-layers')
 
@@ -69,11 +70,19 @@ class CreatePlugin(LayerPlugin):
         with open(os.path.join(example, args.examplerecipe + '_%s.bb') % args.version, 'w') as fd:
             fd.write(example_template)
 
-        logger.plain('Add your new layer with \'bitbake-layers add-layer %s\'' % args.layerdir)
+        if args.add_layer:
+            # Add the layer to bblayers.conf
+            args.layerdir = [layerdir]
+            ActionPlugin.do_add_layer(self, args)
+            logger.plain('Layer added %s' % args.layerdir)
+
+        else:
+            logger.plain('Add your new layer with \'bitbake-layers add-layer %s\'' % args.layerdir)
 
     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('--add-layer', '-a', action='store_true', help='Add the layer to bblayers.conf after creation')
         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')