From ee4d0c879713ba50dc6cc3300f44647faebee2e0 Mon Sep 17 00:00:00 2001 From: grygorii tertychnyi via Openembedded-core Date: Wed, 10 Oct 2018 19:26:24 +0300 Subject: lib/oe/utils: add eol to format_pkg_list() Append '\n' to the non-empty formatted string before return. If you write it to the (manifest) file, it will ensure file ends with a newline. Many GNU utilities have problems processing the last line of a file if it is not '\n' terminated. E.g. if the last line is not terminated by a newline character, then "read" will read it but return false, leaving the broken partial line in the read variable(s). It can also break or adversely affect some text processing tools, that operate on the file. Signed-off-by: grygorii tertychnyi Signed-off-by: Richard Purdie --- meta/lib/oe/utils.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'meta/lib') diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py index 93b0763b0a..d05f517a70 100644 --- a/meta/lib/oe/utils.py +++ b/meta/lib/oe/utils.py @@ -347,7 +347,13 @@ def format_pkg_list(pkg_dict, ret_format=None): for pkg in sorted(pkg_dict): output.append(pkg) - return '\n'.join(output) + output_str = '\n'.join(output) + + if output_str: + # make sure last line is newline terminated + output_str += '\n' + + return output_str def host_gcc_version(d, taskcontextonly=False): import re, subprocess -- cgit 1.2.3-korg