summaryrefslogtreecommitdiffstats
path: root/scripts/lib/recipetool/create.py
diff options
context:
space:
mode:
authorJulien Stephan <jstephan@baylibre.com>2023-12-04 16:59:30 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-12-06 22:55:49 +0000
commit86b9510bd3b7d6235fc5f83de66746c7c2dbba82 (patch)
treec1fcbbaea3f08aa030c506d3a3ceffbced3f18d2 /scripts/lib/recipetool/create.py
parent344e10a21b88292f0cfc04b887bfc77117b3d750 (diff)
downloadpoky-86b9510bd3b7d6235fc5f83de66746c7c2dbba82.tar.gz
recipetool: create: add trailing newlines
create_recipe() function relies on oe.recipeutils.patch_recipe_lines() which relies on bb.utils.edit_metadata(). edit_metada expect lines to have trailing newlines, so add it to each lines before calling patch_recipe_lines, otherwise edit_metadata will not be able to squash blank line if there are two consecutive blanks after a removal (From OE-Core rev: 31b27cc76a1b669e2b126c332608fd772c124d69) 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/lib/recipetool/create.py')
-rw-r--r--scripts/lib/recipetool/create.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index 293198d1c8..f5d541eb6c 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -873,8 +873,10 @@ def create_recipe(args):
873 outlines.append('') 873 outlines.append('')
874 outlines.extend(lines_after) 874 outlines.extend(lines_after)
875 875
876 outlines = [ line.rstrip('\n') +"\n" for line in outlines]
877
876 if extravalues: 878 if extravalues:
877 _, outlines = oe.recipeutils.patch_recipe_lines(outlines, extravalues, trailing_newline=False) 879 _, outlines = oe.recipeutils.patch_recipe_lines(outlines, extravalues, trailing_newline=True)
878 880
879 if args.extract_to: 881 if args.extract_to:
880 scriptutils.git_convert_standalone_clone(srctree) 882 scriptutils.git_convert_standalone_clone(srctree)
@@ -890,7 +892,7 @@ def create_recipe(args):
890 log_info_cond('Source extracted to %s' % args.extract_to, args.devtool) 892 log_info_cond('Source extracted to %s' % args.extract_to, args.devtool)
891 893
892 if outfile == '-': 894 if outfile == '-':
893 sys.stdout.write('\n'.join(outlines) + '\n') 895 sys.stdout.write(''.join(outlines) + '\n')
894 else: 896 else:
895 with open(outfile, 'w') as f: 897 with open(outfile, 'w') as f:
896 lastline = None 898 lastline = None
@@ -898,7 +900,7 @@ def create_recipe(args):
898 if not lastline and not line: 900 if not lastline and not line:
899 # Skip extra blank lines 901 # Skip extra blank lines
900 continue 902 continue
901 f.write('%s\n' % line) 903 f.write('%s' % line)
902 lastline = line 904 lastline = line
903 log_info_cond('Recipe %s has been created; further editing may be required to make it fully functional' % outfile, args.devtool) 905 log_info_cond('Recipe %s has been created; further editing may be required to make it fully functional' % outfile, args.devtool)
904 tinfoil.modified_files() 906 tinfoil.modified_files()