[oe-commits] [openembedded-core] 05/07: lib/oe/utils: add eol to format_pkg_list()

git at git.openembedded.org git at git.openembedded.org
Thu Oct 4 13:29:27 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit ebd01f4ee0680931c8029d43f0b388b7ea71347d
Author: Grygorii Tertychnyi <gtertych at cisco.com>
AuthorDate: Thu Oct 4 08:29:31 2018 +0300

    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 <gtertych at cisco.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 meta/lib/oe/utils.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index 93b0763..d05f517 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

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list