diff options
author | Charlie Davies <charles.davies@whitetree.xyz> | 2021-02-15 20:07:44 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-03-06 22:39:04 +0000 |
commit | 27d0fcddd12e78e7b3b528318a2a6090535cf550 (patch) | |
tree | 658b75da8951e4c81c64e795205b57a1e4972f39 /meta/lib/bblayers | |
parent | b7d1f361ff8618322d21c265c14e8d2afdea7e1f (diff) | |
download | poky-27d0fcddd12e78e7b3b528318a2a6090535cf550.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.
(From OE-Core rev: 8f896bd9b34f19535838757c8f3049bae438e4fe)
Signed-off-by: Charlie Davies <charles.davies@whitetree.xyz>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/bblayers')
-rw-r--r-- | meta/lib/bblayers/create.py | 4 | ||||
-rw-r--r-- | meta/lib/bblayers/templates/layer.conf | 10 |
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): | |||
35 | bb.utils.mkdirhier(conf) | 35 | bb.utils.mkdirhier(conf) |
36 | 36 | ||
37 | layername = os.path.basename(os.path.normpath(args.layerdir)) | 37 | layername = os.path.basename(os.path.normpath(args.layerdir)) |
38 | layerid = args.layerid if args.layerid is not None else layername | ||
38 | 39 | ||
39 | # Create the README from templates/README | 40 | # Create the README from templates/README |
40 | readme_template = read_template('README').format(layername=layername) | 41 | readme_template = read_template('README').format(layername=layername) |
@@ -54,7 +55,7 @@ class CreatePlugin(LayerPlugin): | |||
54 | 55 | ||
55 | # Create the layer.conf from templates/layer.conf | 56 | # Create the layer.conf from templates/layer.conf |
56 | layerconf_template = read_template('layer.conf').format( | 57 | layerconf_template = read_template('layer.conf').format( |
57 | layername=layername, priority=args.priority, compat=compat) | 58 | layerid=layerid, priority=args.priority, compat=compat) |
58 | layerconf = os.path.join(conf, 'layer.conf') | 59 | layerconf = os.path.join(conf, 'layer.conf') |
59 | with open(layerconf, 'w') as fd: | 60 | with open(layerconf, 'w') as fd: |
60 | fd.write(layerconf_template) | 61 | fd.write(layerconf_template) |
@@ -71,6 +72,7 @@ class CreatePlugin(LayerPlugin): | |||
71 | def register_commands(self, sp): | 72 | def register_commands(self, sp): |
72 | parser_create_layer = self.add_command(sp, 'create-layer', self.do_create_layer, parserecipes=False) | 73 | parser_create_layer = self.add_command(sp, 'create-layer', self.do_create_layer, parserecipes=False) |
73 | parser_create_layer.add_argument('layerdir', help='Layer directory to create') | 74 | parser_create_layer.add_argument('layerdir', help='Layer directory to create') |
75 | parser_create_layer.add_argument('--layerid', '-i', help='Layer id to use if different from layername') | ||
74 | parser_create_layer.add_argument('--priority', '-p', default=6, help='Priority of recipes in layer') | 76 | parser_create_layer.add_argument('--priority', '-p', default=6, help='Priority of recipes in layer') |
75 | parser_create_layer.add_argument('--example-recipe-name', '-e', dest='examplerecipe', default='example', help='Filename of the example recipe') | 77 | parser_create_layer.add_argument('--example-recipe-name', '-e', dest='examplerecipe', default='example', help='Filename of the example recipe') |
76 | parser_create_layer.add_argument('--example-recipe-version', '-v', dest='version', default='0.1', help='Version number for the example recipe') | 78 | 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}}" | |||
5 | BBFILES += "${{LAYERDIR}}/recipes-*/*/*.bb \ | 5 | BBFILES += "${{LAYERDIR}}/recipes-*/*/*.bb \ |
6 | ${{LAYERDIR}}/recipes-*/*/*.bbappend" | 6 | ${{LAYERDIR}}/recipes-*/*/*.bbappend" |
7 | 7 | ||
8 | BBFILE_COLLECTIONS += "{layername}" | 8 | BBFILE_COLLECTIONS += "{layerid}" |
9 | BBFILE_PATTERN_{layername} = "^${{LAYERDIR}}/" | 9 | BBFILE_PATTERN_{layerid} = "^${{LAYERDIR}}/" |
10 | BBFILE_PRIORITY_{layername} = "{priority}" | 10 | BBFILE_PRIORITY_{layerid} = "{priority}" |
11 | 11 | ||
12 | LAYERDEPENDS_{layername} = "core" | 12 | LAYERDEPENDS_{layerid} = "core" |
13 | LAYERSERIES_COMPAT_{layername} = "{compat}" | 13 | LAYERSERIES_COMPAT_{layerid} = "{compat}" |