diff options
author | Pedro Baptista <pedro.miguel.baptista@gmail.com> | 2023-02-21 11:49:21 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-02-24 13:31:45 +0000 |
commit | 803e781e42b9c538119c2a56b8478149530cce6d (patch) | |
tree | ac58307b07c662e5aba0e79f0770c0ca8906cb80 | |
parent | f77bf57f26522a98b089ba42f2f744359ca1e4a2 (diff) | |
download | poky-803e781e42b9c538119c2a56b8478149530cce6d.tar.gz |
create.py: add command arg to add layer to bblayers.conf
Add command arg `--add-layer` which enables the create
and add layer in a single step.
(From OE-Core rev: f3be788a55a2dde1f627aa85b08dc3ffa55d751f)
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>
-rw-r--r-- | meta/lib/bblayers/create.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/meta/lib/bblayers/create.py b/meta/lib/bblayers/create.py index c8f3f1b370..517554c587 100644 --- a/meta/lib/bblayers/create.py +++ b/meta/lib/bblayers/create.py | |||
@@ -12,6 +12,7 @@ import shutil | |||
12 | import bb.utils | 12 | import bb.utils |
13 | 13 | ||
14 | from bblayers.common import LayerPlugin | 14 | from bblayers.common import LayerPlugin |
15 | from bblayers.action import ActionPlugin | ||
15 | 16 | ||
16 | logger = logging.getLogger('bitbake-layers') | 17 | logger = logging.getLogger('bitbake-layers') |
17 | 18 | ||
@@ -69,11 +70,19 @@ class CreatePlugin(LayerPlugin): | |||
69 | with open(os.path.join(example, args.examplerecipe + '_%s.bb') % args.version, 'w') as fd: | 70 | with open(os.path.join(example, args.examplerecipe + '_%s.bb') % args.version, 'w') as fd: |
70 | fd.write(example_template) | 71 | fd.write(example_template) |
71 | 72 | ||
72 | logger.plain('Add your new layer with \'bitbake-layers add-layer %s\'' % args.layerdir) | 73 | if args.add_layer: |
74 | # Add the layer to bblayers.conf | ||
75 | args.layerdir = [layerdir] | ||
76 | ActionPlugin.do_add_layer(self, args) | ||
77 | logger.plain('Layer added %s' % args.layerdir) | ||
78 | |||
79 | else: | ||
80 | logger.plain('Add your new layer with \'bitbake-layers add-layer %s\'' % args.layerdir) | ||
73 | 81 | ||
74 | def register_commands(self, sp): | 82 | def register_commands(self, sp): |
75 | parser_create_layer = self.add_command(sp, 'create-layer', self.do_create_layer, parserecipes=False) | 83 | parser_create_layer = self.add_command(sp, 'create-layer', self.do_create_layer, parserecipes=False) |
76 | parser_create_layer.add_argument('layerdir', help='Layer directory to create') | 84 | parser_create_layer.add_argument('layerdir', help='Layer directory to create') |
85 | parser_create_layer.add_argument('--add-layer', '-a', action='store_true', help='Add the layer to bblayers.conf after creation') | ||
77 | parser_create_layer.add_argument('--layerid', '-i', help='Layer id to use if different from layername') | 86 | parser_create_layer.add_argument('--layerid', '-i', help='Layer id to use if different from layername') |
78 | parser_create_layer.add_argument('--priority', '-p', default=6, help='Priority of recipes in layer') | 87 | parser_create_layer.add_argument('--priority', '-p', default=6, help='Priority of recipes in layer') |
79 | parser_create_layer.add_argument('--example-recipe-name', '-e', dest='examplerecipe', default='example', help='Filename of the example recipe') | 88 | parser_create_layer.add_argument('--example-recipe-name', '-e', dest='examplerecipe', default='example', help='Filename of the example recipe') |