diff options
author | Martin Jansa <Martin.Jansa@gmail.com> | 2020-05-30 00:03:27 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-06-04 13:27:29 +0100 |
commit | 41c8e1b7065103d80ab30af290c7487e94b6765c (patch) | |
tree | fb5256439adba203626073bce8fd10b34b2b8133 /meta/lib | |
parent | 71ef6bbb85eba1b872d5eed53c721b42bd8bd22d (diff) | |
download | poky-41c8e1b7065103d80ab30af290c7487e94b6765c.tar.gz |
Revert "lib/oe/patch: fix handling of patches with no header"
* This reverts commit d9971f5dc8eb7de551fd6f5e058fd24770ef5d78.
* With the missing Subject line fixed in GitApplyTree.prepareCommit()
we should be able to revert, the fix which was trying to help it by
parsing GitApplyTree.patch_line_prefix ("%% original patch:") also
from Subject line, now GitApplyTree.patch_line_prefix should always
end on separate line which is then skipped when copying the lines to
resulting patch, see original commit message from Paul:
lib/oe/patch: fix handling of patches with no header
If a patch applied by a recipe has no header and we turn the recipe's
source into a git tree (when PATCHTOOL = "git" or when using devtool
extract / modify / upgrade), the commit message ends up consisting only
of the original filename marker ("%% original patch: filename.patch").
When we come to do turn the commits back into a set of patches in
extractPatches(), this first line ends up in the "Subject: " part of
the file, but we were ignoring it because the line didn't start with the
marker text. The end result was we weren't able to get the original
patch name. Strip off any "Subject [PATCH x/y]" part before looking for
the marker text to fix.
This caused "devtool modify openssl" followed by "devtool update-recipe
openssl" (without any changes in-between) to remove version-script.patch
because that patch has no header and we weren't able to determine the
original filename.
(From OE-Core rev: d9e56db415d386447a299dd633b10f1eda0dd401)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oe/patch.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py index bb1c40aa1e..7ca2e28b1f 100644 --- a/meta/lib/oe/patch.py +++ b/meta/lib/oe/patch.py | |||
@@ -439,7 +439,6 @@ class GitApplyTree(PatchTree): | |||
439 | def extractPatches(tree, startcommit, outdir, paths=None): | 439 | def extractPatches(tree, startcommit, outdir, paths=None): |
440 | import tempfile | 440 | import tempfile |
441 | import shutil | 441 | import shutil |
442 | import re | ||
443 | tempdir = tempfile.mkdtemp(prefix='oepatch') | 442 | tempdir = tempfile.mkdtemp(prefix='oepatch') |
444 | try: | 443 | try: |
445 | shellcmd = ["git", "format-patch", "--no-signature", "--no-numbered", startcommit, "-o", tempdir] | 444 | shellcmd = ["git", "format-patch", "--no-signature", "--no-numbered", startcommit, "-o", tempdir] |
@@ -455,13 +454,10 @@ class GitApplyTree(PatchTree): | |||
455 | try: | 454 | try: |
456 | with open(srcfile, 'r', encoding=encoding) as f: | 455 | with open(srcfile, 'r', encoding=encoding) as f: |
457 | for line in f: | 456 | for line in f: |
458 | checkline = line | 457 | if line.startswith(GitApplyTree.patch_line_prefix): |
459 | if checkline.startswith('Subject: '): | ||
460 | checkline = re.sub(r'\[.+?\]\s*', '', checkline[9:]) | ||
461 | if checkline.startswith(GitApplyTree.patch_line_prefix): | ||
462 | outfile = line.split()[-1].strip() | 458 | outfile = line.split()[-1].strip() |
463 | continue | 459 | continue |
464 | if checkline.startswith(GitApplyTree.ignore_commit_prefix): | 460 | if line.startswith(GitApplyTree.ignore_commit_prefix): |
465 | continue | 461 | continue |
466 | patchlines.append(line) | 462 | patchlines.append(line) |
467 | except UnicodeDecodeError: | 463 | except UnicodeDecodeError: |