summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJulien Stephan <jstephan@baylibre.com>2023-12-05 15:56:32 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-12-06 22:55:46 +0000
commitcd5de8d53849a6f3bb6f82e45fb301e39892c789 (patch)
tree1c740f30baa78a4610b0f14650fbb55d68ee603d /scripts
parenta4628fffcfecb5cd95dc2558dfd39ebd71121eab (diff)
downloadopenembedded-core-contrib-cd5de8d53849a6f3bb6f82e45fb301e39892c789.tar.gz
recipetool: appendsrcfile(s): use params instead of extraline
appendsrc function relies on oe.recipeutils.bbappend_recipe to copy files and add the corresponding entries in SRC_URI. Currently, appendsrc function build itself the new SRC_URI entry to add the correct subdir param, and gives it using the extralines parameter. This has 2 drawbacks: - oe.recipeutils.bbappend_recipe can already do this if we specify the correct params, so we have duplicate code - the duplicated code is not fully functional: for example, it doesn't take into account the -m/--machine parameter So fix this by not using extralines but give correctly formatted params. Also remove the check for already existing entries as oe.recipeutils.bbappend_recipe already implement it The new bbappend file now have the SRC_URI entry after the FILESEXTRAPATHS so fix the selftest. Update test_recipetool_appendsrcfile_existing_in_src_uri_diff_params test because recipetool appendsrcfiles used to not add new src_uri entry if the entry already exist even with different parameters while oe.recipeutils.bbappend_recipe adds it if parameters are different (and remove the old entry) Signed-off-by: Julien Stephan <jstephan@baylibre.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/recipetool/append.py26
1 files changed, 10 insertions, 16 deletions
diff --git a/scripts/lib/recipetool/append.py b/scripts/lib/recipetool/append.py
index 58512e9e4b..fc3cc4a0b7 100644
--- a/scripts/lib/recipetool/append.py
+++ b/scripts/lib/recipetool/append.py
@@ -300,7 +300,9 @@ def appendfile(args):
if st.st_mode & stat.S_IXUSR:
perms = '0755'
install = {args.newfile: (args.targetpath, perms)}
- oe.recipeutils.bbappend_recipe(rd, args.destlayer, {args.newfile: {'path' : sourcepath}}, install, wildcardver=args.wildcard_version, machine=args.machine)
+ if sourcepath:
+ sourcepath = os.path.basename(sourcepath)
+ oe.recipeutils.bbappend_recipe(rd, args.destlayer, {args.newfile: {'newname' : sourcepath}}, install, wildcardver=args.wildcard_version, machine=args.machine)
tinfoil.modified_files()
return 0
else:
@@ -329,6 +331,7 @@ def appendsrc(args, files, rd, extralines=None):
copyfiles = {}
extralines = extralines or []
+ params = []
for newfile, srcfile in files.items():
src_destdir = os.path.dirname(srcfile)
if not args.use_workdir:
@@ -339,22 +342,12 @@ def appendsrc(args, files, rd, extralines=None):
src_destdir = os.path.join(os.path.relpath(srcdir, workdir), src_destdir)
src_destdir = os.path.normpath(src_destdir)
- source_uri = 'file://{0}'.format(os.path.basename(srcfile))
if src_destdir and src_destdir != '.':
- source_uri += ';subdir={0}'.format(src_destdir)
-
- simple = bb.fetch.URI(source_uri)
- simple.params = {}
- simple_str = str(simple)
- if simple_str in simplified:
- existing = simplified[simple_str]
- if source_uri != existing:
- logger.warning('{0!r} is already in SRC_URI, with different parameters: {1!r}, not adding'.format(source_uri, existing))
- else:
- logger.warning('{0!r} is already in SRC_URI, not adding'.format(source_uri))
+ params.append({'subdir': src_destdir})
else:
- extralines.append('SRC_URI += {0}'.format(source_uri))
- copyfiles[newfile] = {'path' : srcfile}
+ params.append({})
+
+ copyfiles[newfile] = {'newname' : os.path.basename(srcfile)}
dry_run_output = None
dry_run_outdir = None
@@ -363,7 +356,8 @@ def appendsrc(args, files, rd, extralines=None):
dry_run_output = tempfile.TemporaryDirectory(prefix='devtool')
dry_run_outdir = dry_run_output.name
- appendfile, _ = oe.recipeutils.bbappend_recipe(rd, args.destlayer, copyfiles, None, wildcardver=args.wildcard_version, machine=args.machine, extralines=extralines, redirect_output=dry_run_outdir)
+ appendfile, _ = oe.recipeutils.bbappend_recipe(rd, args.destlayer, copyfiles, None, wildcardver=args.wildcard_version, machine=args.machine, extralines=extralines, params=params,
+ redirect_output=dry_run_outdir)
if args.dry_run:
output = ''
appendfilename = os.path.basename(appendfile)