diff options
author | Yoann Congal <yoann.congal@smile.fr> | 2023-12-05 09:44:18 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-12-06 22:55:49 +0000 |
commit | 2c59f5ad01aa0e6dfd1e6291e770c77041be762e (patch) | |
tree | a663429de31911c66fc388b6ba350313ec307f09 | |
parent | 463d56b9f075d03c264341724038ec322d855c47 (diff) | |
download | poky-2c59f5ad01aa0e6dfd1e6291e770c77041be762e.tar.gz |
lib/oe/patch: handle creating patches for CRLF sources
Using devtool to patch CRLF based sources creates patch files which have
mixed end of lines : LF for headers and CRLF for source context and
modified lines.
Python open(..., newline=None) (default for newline arg)does detect
end-of-line in this mixed file but only outputs LF EOL data. This
result in patch files that does not apply on the original sources.
Switching to open(..., newline='') allows to detect end-of-line but keep
the original end-of-line intact. This generate correct patches for CRLF
based sources.
Fixes [YOCTO #15285]
(From OE-Core rev: 58f845499c0277a2b8069eefa235430b5f5f7661)
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/lib/oe/patch.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py index e4bb5a7839..d5ad4f3dc1 100644 --- a/meta/lib/oe/patch.py +++ b/meta/lib/oe/patch.py | |||
@@ -478,7 +478,7 @@ class GitApplyTree(PatchTree): | |||
478 | patchlines = [] | 478 | patchlines = [] |
479 | outfile = None | 479 | outfile = None |
480 | try: | 480 | try: |
481 | with open(srcfile, 'r', encoding=encoding) as f: | 481 | with open(srcfile, 'r', encoding=encoding, newline='') as f: |
482 | for line in f: | 482 | for line in f: |
483 | if line.startswith(GitApplyTree.patch_line_prefix): | 483 | if line.startswith(GitApplyTree.patch_line_prefix): |
484 | outfile = line.split()[-1].strip() | 484 | outfile = line.split()[-1].strip() |