diff mbox series

[v3,04/10] recipeutils: bbappend_recipe: add a way to specify the name of the file to add

Message ID 20231205145636.960819-5-jstephan@baylibre.com
State Accepted, archived
Commit e7bc09e5c9d7a0f4f8f4eba40730b68857b00677
Headers show
Series Several fixes around recipetool appendsrcfile(s) and oe.recipeutils.bbappend_recipe | expand

Commit Message

Julien Stephan Dec. 5, 2023, 2:56 p.m. UTC
bbappend_recipe can take a dict of source files to add to SRC_URI where
the key is the full path to the file to be added and the value is a dict

Add a new optionnal entry "newname" to specify the name of the newly added file

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
---
 meta/lib/oe/recipeutils.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py
index 01c9ad190fe..1d793693bfd 100644
--- a/meta/lib/oe/recipeutils.py
+++ b/meta/lib/oe/recipeutils.py
@@ -677,6 +677,8 @@  def bbappend_recipe(rd, destlayerdir, srcfiles, install=None, wildcardver=False,
                 path: the original filename as it would appear in SRC_URI
                     or None if it isn't already present.
                 patchdir: the patchdir parameter
+                newname: the name to give to the new added file. None to use
+                    the default value: basename(path)
             You may pass None for this parameter if you simply want to specify
             your own content via the extralines parameter.
         install: dict mapping entries in srcfiles to a tuple of two elements:
@@ -769,7 +771,10 @@  def bbappend_recipe(rd, destlayerdir, srcfiles, install=None, wildcardver=False,
         for i, (newfile, param) in enumerate(srcfiles.items()):
             srcurientry = None
             if not 'path' in param or not param['path']:
-                srcfile = os.path.basename(newfile)
+                if 'newname' in param and param['newname']:
+                    srcfile = param['newname']
+                else:
+                    srcfile = os.path.basename(newfile)
                 srcurientry = 'file://%s' % srcfile
                 if params and params[i]:
                     srcurientry = '%s;%s' % (srcurientry, ';'.join('%s=%s' % (k,v) for k,v in params[i].items()))