All of lore.kernel.org
 help / color / mirror / Atom feed
From: nvhieudt11@gmail.com
To: bitbake-devel@lists.openembedded.org
Subject: Re: [PATCH] Support add-layer to prepend
Date: Mon, 19 Feb 2024 08:51:25 -0800	[thread overview]
Message-ID: <16399.1708361485507574514@lists.openembedded.org> (raw)
In-Reply-To: <202402072236195f1ece48@mail.local>


[-- Attachment #1.1: Type: text/plain, Size: 364 bytes --]

Hi Alexandre Belloni,

Sorry for the late reply.
I'm not sure why you can't apply my patch. I tried applying it again and there was no problem.
I'd like to attach my patch, could you please check it again (0001-bitbake-Support-add-layer-to-prepend.patch)
https://github.com/hieunv0828/bitbake/commit/fc670b7ba577958eb18b108458f24fd2c260e225

Thanks!
Hieu

[-- Attachment #1.2: Type: text/html, Size: 585 bytes --]

[-- Attachment #2: 0001-bitbake-Support-add-layer-to-prepend.patch --]
[-- Type: application/octet-stream, Size: 2972 bytes --]

From fc670b7ba577958eb18b108458f24fd2c260e225 Mon Sep 17 00:00:00 2001
From: Hieu Van Nguyen <hieu2.nguyen@lge.com>
Date: Mon, 5 Feb 2024 08:01:43 +0000
Subject: [PATCH] bitbake: Support add-layer to prepend

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>
---
 lib/bb/utils.py        | 7 +++++--
 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 068b631c..086f1cc8 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -1412,7 +1412,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
@@ -1482,7 +1482,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 a8f26993..57d7195c 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)')
-- 
2.43.0


  reply	other threads:[~2024-02-19 16:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-05 11:31 [PATCH] Support add-layer to prepend nvhieudt11
2024-02-07 22:36 ` [bitbake-devel] " Alexandre Belloni
2024-02-19 16:51   ` nvhieudt11 [this message]
2024-03-20 23:15 ` Richard Purdie
2024-03-28  6:49   ` nvhieudt11
2024-03-28 14:06     ` [bitbake-devel] " Peter Kjellerstedt
2024-03-28 14:56       ` nvhieudt11

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16399.1708361485507574514@lists.openembedded.org \
    --to=nvhieudt11@gmail.com \
    --cc=bitbake-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.