diff options
author | Hieu Van Nguyen <hieu2.nguyen@lge.com> | 2024-02-05 08:01:43 +0000 |
---|---|---|
committer | Martin Jansa <martin.jansa@gmail.com> | 2024-04-16 09:28:40 +0200 |
commit | 7a16a0a36aad3a80fd9fe47c44fc102651ba19b0 (patch) | |
tree | d739433d2b59e1588d19bb5b2c034fe0b4bb956d | |
parent | 10e254d1138075d0a0ac05f9f4939a8ec3c7bd94 (diff) | |
download | bitbake-contrib-jansa/master.tar.gz |
bitbake: Support add-layer to prependjansa/master
As you know, layer order in BBLAYERS can affect in parsing recipes process,
in some cases, users want to add a layer on the top of BBLAYERS variable
So, add "--prepend" option for bitbake-layers to support add-layer to prepend
Signed-off-by: Hieu Van Nguyen <hieu2.nguyen@lge.com>
Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
-rw-r--r-- | lib/bb/utils.py | 7 | ||||
-rw-r--r-- | lib/bblayers/action.py | 3 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/bb/utils.py b/lib/bb/utils.py index ebee65d3d..a4d8d2d1e 100644 --- a/lib/bb/utils.py +++ b/lib/bb/utils.py @@ -1414,7 +1414,7 @@ def edit_metadata_file(meta_file, variables, varfunc): return updated -def edit_bblayers_conf(bblayers_conf, add, remove, edit_cb=None): +def edit_bblayers_conf(bblayers_conf, add, remove, prepend=None, edit_cb=None): """Edit bblayers.conf, adding and/or removing layers Parameters: bblayers_conf: path to bblayers.conf file to edit @@ -1484,7 +1484,10 @@ def edit_bblayers_conf(bblayers_conf, add, remove, edit_cb=None): for addlayer in addlayers: if addlayer not in bblayers: updated = True - bblayers.append(addlayer) + if prepend: + bblayers.insert(0,addlayer) + else: + bblayers.append(addlayer) del addlayers[:] if edit_cb: diff --git a/lib/bblayers/action.py b/lib/bblayers/action.py index a8f269933..57d7195cd 100644 --- a/lib/bblayers/action.py +++ b/lib/bblayers/action.py @@ -49,7 +49,7 @@ class ActionPlugin(LayerPlugin): shutil.copy2(bblayers_conf, backup) try: - notadded, _ = bb.utils.edit_bblayers_conf(bblayers_conf, layerdirs, None) + notadded, _ = bb.utils.edit_bblayers_conf(bblayers_conf, layerdirs, None, args.prepend) self.tinfoil.modified_files() if not (args.force or notadded): try: @@ -267,6 +267,7 @@ build results (as the layer priority order has effectively changed). def register_commands(self, sp): parser_add_layer = self.add_command(sp, 'add-layer', self.do_add_layer, parserecipes=False) parser_add_layer.add_argument('layerdir', nargs='+', help='Layer directory/directories to add') + parser_add_layer.add_argument('--prepend', action='store_true', help='Prepend layer directory/directories') parser_remove_layer = self.add_command(sp, 'remove-layer', self.do_remove_layer, parserecipes=False) parser_remove_layer.add_argument('layerdir', nargs='+', help='Layer directory/directories to remove (wildcards allowed, enclose in quotes to avoid shell expansion)') |